The issue

While trying to publish an NPM package to our artifacts registry in Azure DevOps, we got an error:

npm failed with return code: 4294963248

The exit code for the task was -4048. Strange thing is that we have our build agents running on-prem, but running this task locally on our dev machines worked just fine. We found out pretty quickly that it was an authentication issue. Because of this we thought that the npm publish task of Azure DevOps might have issues with getting the authentication right for the registry. Although we specified the registry to publish to in the task, we kept getting the error. After passing in a JWT token of one of our team members into the npm publish task, it did work. This made us to be suspicuous of the npm publish task even more…

Investigating further

After diving into the logs, my colleague noticed something was off. The registry URL we were using, was

https://pkgs.dev.azure.com/<organization_name>/_packaging/<feedName>/npm/registry/.

But as soon as we tried installing a package from out registry, the logs showed a different URL alltogether:

https://<organization_name>.pkgs.visualstudio.com/_packaging/<feedUUID>/npm/registry. 

So it looks like the Azure DevOps build pipelines have issues using the Azure DevOps URL, while the issue is not there when using the VisualStudio URL.

The solution

The solution is as simple as can be: we changed the URL for the feed. The publish task works like a charm now.

We’re guessing the issue might be with the New Azure DevOps URL setting that you can find under Organization settings – Overview. Since we’re not quite sure of the impact, we haven’t tested it yet… As soon as we do, I’ll update this post with the results 🤓

New Azure DevOps URL setting