craftship / codebox-npm

Serverless private npm registry using https://serverless.com/

Home Page:http://codebox.sh/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`npm login` fails with later versions of client NPM

zakhenry opened this issue · comments

This is a Bug Report

Description

For bug reports:

  • What went wrong?
    Attempting to login, received 403 from registry
  • What did you expect should have happened?
    I should have logged in (credentials were all correct)
  • What stacktrace or error message did you
    experience?
$ npm login
Username: zakhenry.123456
Password: 
Email: (this IS public) zak.henry@[email]
npm ERR! code E403
npm ERR! Forbidden

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/zak/.npm/_logs/2018-01-15T16_12_13_279Z-debug.log

  • NPM CLI version you are using:
    (client) node v8.9.1 (npm v5.5.1)

Extra info: @zakhenry and I are seeing this with codebox-npm version 0.21.2.

The same setup works when used with node v8.2.1 (npm v5.3.0).

Same for me. I also got the same error.
node 6.11.2
npm 5.5.1

So I have looked into this one. I used npm 5.5.1 and it looks like if you do not include a trailing slash when setting the registry url due to the url resolve in the npm/npm-profile module (https://github.com/npm/npm-profile/blob/latest/lib/index.js#L164):

Without the trailing slash it will resolve to (incorrect):
https://abc12345.execute-api.eu-west-1.amazonaws.com/prod/-/user/org.couchdb.user:username

With the trailing slash it will resolve to (correct):
https://abc12345.execute-api.eu-west-1.amazonaws.com/prod/registry/-/user/org.couchdb.user:username

npm set registry https://abc12345.execute-api.eu-west-1.amazonaws.com/prod/registry/ <--

Can you try you try setting you registry with a trailing slash and let me know how you get on so I can close the issue if this fixes it.

Will also then add a note to the README that this is now very important.

Thanks for reporting, been on the cards to dig into this one for a while.

Closing this for now, please do try the mentioned steps and re-open if this is still an issue.

Thanks!

worth updating readme section about Using it in your Repositories as no trailing slash in example, this caught me out copy and editing.

please update the readme, I just wasted 3 hours on this because the 403 error is very non-descriptive. Thought my github user was missing permissions, disabled two factor auth, and finally found this post.