dependabot-azure-devops: Invalid auth configuration found error when an update is found in a private npm artifacts feed
Following the update to 1.20 our pipeline encounters the following error when an update is found,
npm ERR! code ERR_INVALID_AUTH
npm ERR! Invalid auth configuration found: _auth must be renamed to //pkgs.dev.azure.com/our-org/_packaging/our-feed/npm/registry/:_auth in project config
npm ERR! Please run npm config fix to repair your configuration.`
We previously had dockerImageTag set to 0.18 and this was working up until recently when the image per ecosystem update kicked in forcing us to update to 1.20 so I can’t be sure whether we would have encountered the same error with 0.19.
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 4
- Comments: 22 (6 by maintainers)
We’re also seeing this problem after switching to 1.20+. In our configuration, we’re using Azure Artifacts as the only registry, with upstream feeds to npmjs et.al. Our .npmrc looks like:
This also means that every package in
package-lock.jsonwill have the above registry as theresolvedURL. From what I can deduce by looking at the npmrc_builder.rb file in dependabot-core, this means that this registry will be classified as aglobalregistry, see: https://github.com/dependabot/dependabot-core/blob/f9754d41004cb5a507b3cd4920fbf48551f9aced/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/npmrc_builder.rb#L84This in turn leads to this part of the code https://github.com/dependabot/dependabot-core/blob/f9754d41004cb5a507b3cd4920fbf48551f9aced/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/npmrc_builder.rb#L165 creating the following
.npmrc:This is a problem, because since NPM v8, all auth-related values need to be scoped, see: https://docs.npmjs.com/cli/v9/configuring-npm/npmrc?v=true#auth-related-configuration
A correct
.npmrcneeds to look like:My conclusion is that the problem lies in dependabot-core in that it no longer creates a compatible
.npmrcfor NPM > v8I’ve created an issue there, let’s see what the response is: https://github.com/dependabot/dependabot-core/issues/7759
@mburumaxwell I have the same issue the others have. I have meticulously followed your example and the examples in the documentation and none work - I get the error:
I noticed one anomaly in your own config, you have:
token: 'tingle:${{DEFAULT_TOKEN}}'In the docs it specifically states:
How come
tingleis working as a token prefix for you when it should bePAT? I’ve tried both our registry namespace andPATbut neither are working. Going to give the suggestion from pawelrakoczy a go now. UPDATE: The workaround from pawelrakoczy did not work for me. I have the same ERR_INVALID_AUTH issuedependabot.azpipeline.yml:/.github/dependabot.yml:/.npmrc: