Skip to content
This repository has been archived by the owner on Apr 17, 2020. It is now read-only.

RequestError [HttpError]: Bad credentials #1

Open
ljharb opened this issue Mar 24, 2020 · 9 comments
Open

RequestError [HttpError]: Bad credentials #1

ljharb opened this issue Mar 24, 2020 · 9 comments

Comments

@ljharb
Copy link

ljharb commented Mar 24, 2020

npx https://github.com/andrewhughes101/dependents-testing es-abstract 10 forks prints out a bunch of errors, and then spits out a bunch of data (not JSON):

Dependant {
  name: 'deep-equal',
  weeklyDownloads: 10404278,
  forks: 'undefined',
  stars: 'undefined',
  watchers: 'undefined'
}
Dependant {
  name: 'util.promisify',
  weeklyDownloads: 11071664,
  forks: 'undefined',
  stars: 'undefined',
  watchers: 'undefined'
}
Dependant {
  name: 'object.values',
  weeklyDownloads: 8583399,
  forks: 'undefined',
  stars: 'undefined',
  watchers: 'undefined'
}
Dependant {
  name: 'object.entries',
  weeklyDownloads: 6529373,
  forks: 'undefined',
  stars: 'undefined',
  watchers: 'undefined'
}
Dependant {
  name: 'array-includes',
  weeklyDownloads: 7081656,
  forks: 'undefined',
  stars: 'undefined',
  watchers: 'undefined'
}
Dependant {
  name: 'promise.prototype.finally',
  weeklyDownloads: 1816944,
  forks: 'undefined',
  stars: 'undefined',
  watchers: 'undefined'
}
Dependant {
  name: 'string.prototype.padstart',
  weeklyDownloads: 1827391,
  forks: 'undefined',
  stars: 'undefined',
  watchers: 'undefined'
}
Dependant {
  name: 'array.prototype.find',
  weeklyDownloads: 2406642,
  forks: 'undefined',
  stars: 'undefined',
  watchers: 'undefined'
}
Dependant {
  name: 'object.getownpropertydescriptors',
  weeklyDownloads: 11001113,
  forks: 'undefined',
  stars: 'undefined',
  watchers: 'undefined'
}
Dependant {
  name: 'string.prototype.padend',
  weeklyDownloads: 2692301,
  forks: 'undefined',
  stars: 'undefined',
  watchers: 'undefined'
}

Is there something I'm missing?

@andrewhughes101
Copy link
Owner

@ljharb Sorry about that, forget to add a note or do a check for a github api token. I've fixed it up now and the dependents should be outputted in JSON now. PTAL

@ljharb
Copy link
Author

ljharb commented Mar 25, 2020

Thanks; when I set that token, now I get:

Getting first 10 dependents of es-abstract sorted by forks
There are a total of 94 dependents
(node:95662) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefined
    at Object.getRepoData ($HOME/.npm/_npx/95662/lib/node_modules/dependents-testing/lib/github.js:35:20)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:95662) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:95662) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@andrewhughes101
Copy link
Owner

I can't reproduce what your seeing, but I've updated the code to fix the problem I think your seeing PTAL

@ljharb
Copy link
Author

ljharb commented Mar 25, 2020

Same credentials error (the length crash is fixed). What permissions does the token need to have? Most tokens should have repo read access, I'd think.

@andrewhughes101
Copy link
Owner

andrewhughes101 commented Mar 25, 2020

The token should just need public repo access I think.

Just tried it with a token with no additional scope permissions and it works for me 😕

@ljharb
Copy link
Author

ljharb commented Mar 25, 2020

Then it's likely not the token. Is there any more debug logging that can be done (currently it's just an unhandled promise rejection)? Happy to test a branch, as well.

@andrewhughes101
Copy link
Owner

Ive pushed a commit to log the error before throwing but I think thats the best I can do at the moment

@ljharb
Copy link
Author

ljharb commented Mar 25, 2020

Hmm, I guess it was a bad token; I used a different one and it's sort of working.

It seems like github's deps api doesn't allow you to only get direct deps? i'm mostly interested in testing things that directly depend on me.

@andrewhughes101
Copy link
Owner

The tool just grabs all the deps from this page https://www.npmjs.com/browse/depended/es-abstract

Its not ideal, and I know there's an issue thats been raised in package maintenance to see if there is or can be other ways of doing this nodejs/package-maintenance#331

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants