Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] port, username and password are lost from npm registry url during "reify" stage #4443

Open
2 tasks done
simllll opened this issue Feb 19, 2022 · 7 comments
Open
2 tasks done
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release

Comments

@simllll
Copy link

simllll commented Feb 19, 2022

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

I've set up a custom npm registry with verdaccio. This registry is besides some firewall rules, only accessable with a http basic auth. Therefore my repository urls look like:
http://user:pwd@somehost:someport/

If I run npm install now, it downloads all packages, and when it reaches the reify stage, it tries to load some metadata again I guess, but now it tries to donwload it from http://somehost/ <-- username, password and port are lost in the url?
It's not a debug messgae fail, I also checked the network traffic.

It gets stuck on this kind of log messages:
=> => # npm sill tarball no local data for depd@http://somehost/depd/-/depd-1.1.2.tgz. Extracting by manifest.
=> => # npm sill tarball no local data for @sentry/types@http://somehost/@sentry%2ftypes/-/types-6.17.4.tgz. Extracting by manifest.
=> => # npm sill tarball no local data for @sentry/utils@http://somehost/@sentry%2futils/-/utils-6.17.4.tgz. Extracting by manifest.
=> => # npm sill tarball no local data for @sentry/types@http://somehost/@sentry%2ftypes/-/types-6.17.4.tgz. Extracting by manifest.
=> => # npm sill tarball no local data for @sentry/utils@http://somehost/@sentry%2futils/-/utils-6.17.4.tgz. Extracting by manifest.
=> => # npm sill tarball no local data for debug@http://somehost/debug/-/debug-2.6.9.tgz. Extracting by manifest.

Expected Behavior

It should always use the correct version of the npm registry url, and should not "modify" it.

Steps To Reproduce

  1. set up a verdaccio server on a custom port and protect it with uername and password, I guess it would be enough to host it on a custom port already, as the port is also dropped from the url (but haven't tested it)
  2. run npm install
  3. see it fails after download of packages completed, when the "reify" stage starts

Environment

  • npm: 8.5.1 (tried also 8.4.0 and 8.5.0 )
  • Node.js: v16.11.0
  • OS Name: linux
@simllll simllll added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Feb 19, 2022
@simllll simllll changed the title [BUG] npm registry is lost / modified during "reify" stage [BUG] correct npm registry url is lost / modified during "reify" stage Feb 19, 2022
@simllll simllll changed the title [BUG] correct npm registry url is lost / modified during "reify" stage [BUG] port, username and password are lost from npm registry url during "reify" stage Feb 19, 2022
@simllll
Copy link
Author

simllll commented Feb 21, 2022

maybe related #3284

@fritzy
Copy link
Contributor

fritzy commented Feb 24, 2022

Can you use npm adduser with your registry and then edit your .npmrc to include always-auth=true? Please re-open if this you're still having this issue.

@fritzy fritzy closed this as completed Feb 24, 2022
@simllll
Copy link
Author

simllll commented Feb 24, 2022

Hi @fritzy , thanks for coming back to me. It's not about the registry authentication, it's about the http authentication (Basic auth), and also about the network port. The issue is on the "http layer". The endpoint url is missing the port, username and password from the original url.

@simllll
Copy link
Author

simllll commented Feb 25, 2022

@fritzy please reopen this one!

@ljharb ljharb reopened this Feb 25, 2022
@nlf
Copy link
Contributor

nlf commented Mar 7, 2022

@simllll can you fetch the json representing one of the packages (i.e. http://somehost/@sentry%2ftypes) and post it here? if it's not feasible to post the result in its entirety, the things i'm interested in are the _resolved and dist properties of version 6.17.4

do you have a package-lock.json already? if so, do the resolved values in your package-lock.json look correct?

@balagge
Copy link

balagge commented Mar 28, 2024

Possibly related: npm repo also drops port number from the repository URL set up in package.json.

npm version 10.5.0.

@swnia
Copy link

swnia commented Sep 13, 2024

This is still happening on npm install 10.7.0 and 10.8.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

6 participants