We use update-notifier in our packages, which previously worked in our npm Private Packages setup. After switching to VSTS Package Management for npm, we noticed we no longer received update notifications for newer versions in our registry.
update-notifier has this dependency chain: update-notifier -> latest-version -> package-json -> registry-auth-token
I traced down the error to occur in registry-auth-token, specifically in the getAuthInfoForUrl method when attempting to populate the bearerAuth variable. In the now-failing setup, the value is undefined, which bubbles an error up the chain and results in a 401 - Unauthorized as it still makes the call with no authentication. undefined itself is not invalid for the code - it could well be a public package or registry - and I would not typically expect a flaw in a package that has been downloaded millions of times.
When comparing our known-good .npmrc file we used for npm Private Packages with our new one for VSTS, I noticed that the registry entries did not match correctly.
.npmrc - npm (matches)
.npmrc - VSTS (does not match - see trailing "registry")
This indicated to me that it could not resolve the proper entry with the auth token for the registry url. After removing "registry" and re-running our update-notifier process, I saw the expected update message; however, any installs now failed because the registry could not be contacted anymore. Modifications to either part of the URL were unsuccessful.
We extracted both the registry URL and the token setup straight and exactly from VSTS' Package Management site (via "Connect to feed"), so I am at a bit of a loss as to where to go from here.
Any help would be greatly appreciated!
Added a solution by Zach̲ Re̲nner · Apr 06 at 09:37 PM
As Simon notes, we determined that this is due to bugs in registry-auth-token as well as registry-url, which update-notifier uses.
We're also investigating changing our recommendation for registry/auth urls to be consistent and include a trailing slash (.../_packaging/<feedName>/npm/registry/)
I'm marking this issue as "Fixed Pending Release", as that best represents the state of the fix to registry-url, as well as our possible change.
p cannot pass in lambda expression
Cloning menu doesn't scroll on Mac OS
VSTS Team capacity issue
VS2017 installation problem
VS2017 Enterprise Installation Problem