node.jsamazon-web-servicesnpmsemantic-releaseaws-codeartifact

AWS CodeArtifact public npm package version missing


I'm using AWS CodeArtifact for private npm registry. Project has tons of dependencies and all those are resolved correctly. We are publishing packages to our registry successfully and using them as dependencies in other projects, everything is working as expected before it was decided to introduce semantic-release and here what happened:

$ npm i semantic-release
npm ERR! code ETARGET
npm ERR! notarget No matching version found for registry-auth-token@^3.0.1.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget 
npm ERR! notarget It was specified as a dependency of 'package-json'
npm ERR! notarget 

This only happens when using private registry. And if we check both upstream and downstream repositories in CodeArtifact - only one version is available/cached (latest) for this package, whereas public npm holds registry-auth-token@^3.0.1 and it is possible to install this version with public npmjs registry.

AWS docs says

  1. If my-repo contains the requested package version, it is returned to the client.
  2. If my-repo does not contain the requested package version, CodeArtifact looks for it in my repo's upstream repositories.
  3. If the package version is found, a reference to it is copied to my-repo, and the package version is returned to the client.

According to these points if version exists in public npm it will be pulled to downstream and cached and it is indeed work with other random packages I tried to install missing/old/unused versions, but registry-auth-token and registry-url are cached only with latest versions and any attempt to install other version ends up with

error notarget No matching version found for registry-auth-token@^3.0.1.

Why does CodeArtifact can't resolve particular packages versions and can resolve other? Is it the problem with CodeArtifact or am I doing smth. wrong?

I already tried all known (to me) ways to resolve such kind of problems:

Any help is much appreciated.


Solution

  • This is a known issue. Till a fix is released, please download the package from another source and manually publish it to your CodeArtifact repository.

    Edit 18/08/2020

    Packages starting with the name "registry" had a download issue which is now resolved so the above workaround is not longer required.