Closed indexzero closed 10 years ago
@othiym23 any word on this? I'd love to actually use the new client you've been putting work into!
This is a legit bug. I asked @othiym23 yesterday and he said that he was in the middle of some surgery in npm-registry-client, so it'll get addressed soon.
Thanks @isaacs. Spoke a bit about it with @terinjokes and the fix in #74 and https://github.com/npm/npm/pull/6514 seems to be the better solution. Going to close this in favor of those.
@izs @othiym23 We've been seeing a lot of:
So after running in to it again tonight for seemingly no reason, I sat down to figure it out. Starting with the proper "nerf darts" (lol @jennschiffer on that name btw) in my
.npmrc
:when trying to do an
npm unpublish somepkg1042 --force
(and a cache miss I believe):I got bounced back for auth credentials. But why!? I threw in some
console.dir
around authify to try to get more information because as I saw above the nerf darts are clearly valid:This is when the real problem was revealed:
As you can see: the parsed URL object which is reformatted before being passed to
getCredentialsByURI
includes any querystring parameters like?write=true
which are not in the "nerf darts" stored in the.npmrc
files.This pull-request fixes this by passing in a more minimal object to
url.format
to exclude the querystrings given togetCredentialsByURI
. This seems preferable to deleting the appropriate keys inparsed
since the object is used elsewhere in the caller functions. It also adds unit tests for authify which are easy to extend for more edge cases like this (scopes, etc).