raineorshine / npm-check-updates

Find newer versions of package dependencies than what your package.json allows
Other
9.44k stars 329 forks source link

v17 request error for private package with proxy enabled #1456

Open shaunxu opened 1 month ago

shaunxu commented 1 month ago

May similar with https://github.com/raineorshine/npm-check-updates/issues/1436


Steps to Reproduce

Private packages defined in package.json, use proxy, ether though environment variant HTTPS_PROXY=http://HOST:PORT, or through .npmrc, will cause ncu response 400 Bad Request.

For example HTTPS_PROXY=http://HOST:PORT npx ncu

Current Behavior

[================----] 4/5 80%vL: 400 Bad request - GET https://npm.pkg.github.com/@atinc/chaos
    at /Users/shaunxu/github/parthenon/node_modules/npm-check-updates/build/index.js:347:925
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  headers: [Object: null prototype] {
    'content-length': [ '90' ],
    'cache-control': [ 'no-cache' ],
    connection: [ 'close' ],
    'content-type': [ 'text/html' ],
    'x-fetch-attempts': [ '1' ]
  },
  statusCode: 400,
  code: 'E400',
  method: 'GET',
  uri: 'https://npm.pkg.github.com/@atinc/chaos',
  body: <Buffer 3c 68 74 6d 6c 3e 3c 62 6f 64 79 3e 3c 68 31 3e 34 30 30 20 42 61 64 20 72 65 71 75 65 73 74 3c 2f 68 31 3e 0a 59 6f 75 72 20 62 72 6f 77 73 65 72 20 ... 40 more bytes>,
  pkgid: '@atinc/chaos'
}

Expected Behavior

Successful check.

raineorshine commented 1 month ago

Thanks for reporting. Given the specifics of npm config and authentication particular to each case, the best way to assist on this issue is to investigate it on the machine where it originates. It's difficult for me to reproduce the specific credentials on my machine. I'm happy to answer any questions you might have about the codebase.

shaunxu commented 1 month ago

Thanks @raineorshine I will try to provide more details for future investigation.