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

Yarn tries to authenticate against registry.yarnpkg.com instead of private registry during publish #3755

Closed
betalb opened this issue Jun 29, 2017 · 11 comments
Assignees
Labels

Comments

@betalb
Copy link

betalb commented Jun 29, 2017

Do you want to request a feature or report a bug?
bug

What is the current behavior?
We have scoped package that should be published to private npm registry, served by internally hosted Nexus (http://nexus.dev/repository/npm-releases)

When we try to publish them, log indicates that yarn is trying to authenticate against registry.yarnpkg.com instead of our hosted Nexus registry

verbose 2.439 Performing "PUT" request to "https://registry.yarnpkg.com/-/user/org.couchdb.user:deployer"
verbose 19.8 Request "https://registry.yarnpkg.com/-/user/org.couchdb.user:ddfgdfg" finished with status code 401.
verbose 19.805 Error: Incorrect username or password.

But there is something that I mentioned when was experimenting with this feature and providing random user names

verbose 14.576 Performing "PUT" request to "https://registry.yarnpkg.com/-/user/org.couchdb.user:ddfgdfg0".
verbose 15.617 Request "https://registry.yarnpkg.com/-/user/org.couchdb.user:ddfgdfg0" finished with status code 201.

In case of 201 status yarn will try next repo and in my case it was nexus repository

Next time you try the same randomly generated username (in my case ddfgdfg0) registry.yarnpkg.com will return 401

If the current behavior is a bug, please provide the steps to reproduce.

Steps with random username

What is the expected behavior?
Yarn should get correct registry url for package scope and perform communication only with this repo

Please mention your node.js, yarn and operating system version.
Yarn version: 0.27.1
Node version: 7.10.0
Platform: win32 x64

@bestander
Copy link
Member

related #3765?

@bestander
Copy link
Member

@betalb, can you confirm if this is a regression from current stable (0.24.6)?

@betalb betalb changed the title Yarn tries to authenticate agains registry.yarnpkg.com instead of private registry Yarn tries to authenticate against registry.yarnpkg.com instead of private registry Jun 30, 2017
@betalb betalb changed the title Yarn tries to authenticate against registry.yarnpkg.com instead of private registry Yarn tries to authenticate against registry.yarnpkg.com instead of private registry during publish Jun 30, 2017
@betalb
Copy link
Author

betalb commented Jun 30, 2017

@bestander Looks like #3765 is about yarn install while this issue is about yarn publish of scoped packages, initially I found it on 0.24.6, so personally I don't think that this bug blocks RC promotion to stable

@bestander
Copy link
Member

Thanks, @betalb.

@arcanis
Copy link
Member

arcanis commented Aug 7, 2017

Hi @betalb! Can you confirm this is still a problem on the latest Yarn release?

@betalb
Copy link
Author

betalb commented Aug 8, 2017

@arcanis Yes, it is still reproducible winth yarn 0.27.5 & 0.28.4

The same behaviour that I described above

The only change seems to be that when using random name it tries to perform self-registration (I've received email from npm registry) and registry replies with 201 status and then nexus registry is tried

@BYK
Copy link
Member

BYK commented Aug 13, 2017

@betalb would you mind trying this with the latest nightlies?

@betalb
Copy link
Author

betalb commented Aug 15, 2017

@BYK checked with nightly 1.0.0-20170815.1354, behaviour is the same

@arcanis
Copy link
Member

arcanis commented Aug 24, 2017

I think I understand what happened - --registry is simply not a valid option for yarn login. I'll work on this, but in the meantime @betalb can you please try to add the following line in your ~/.yarnrc file?

registry "http://nexus.dev/repository/npm-releases"

@betalb
Copy link
Author

betalb commented Aug 25, 2017

@arcanis This is strange, after running login with registry switch, I got following record in .yarnrc

"@company-scope:registry" "http://nexus.dev/repository/npm-releases/"

And it looks like the issue is only with scoped packages when non-scoped registry record is missing in .yarnrc, I've tried to repeat the steps from original report, just removed --scope argument, and now publish looks fine.

It seems that yarn is using non-scoped record from .yarnrc and when it is absent -- registry.yarnpkg.com for every publish

@BYK
Copy link
Member

BYK commented Oct 26, 2017

This should be fixed on master. Also, we now have the --registry option so closing.

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

No branches or pull requests

4 participants