sonatype / nexus-public

Sonatype Nexus Repository Open-source codebase mirror
https://www.sonatype.com/products/repository-oss-download
Eclipse Public License 1.0
1.95k stars 572 forks source link

Hosted npm repository: Endpoint /{package}/{version} does not return information about specific package version #224

Open WIStudent opened 1 year ago

WIStudent commented 1 year ago

I have a hosted npm repository my-npm and published an npm package @foo/bar with version 1.0.0 to it. According to the npm registry API documentation the endpoint /{package}/{version} should return information about that specific version, but http://localhost:8081/repository/my-npm/@foo%2Fbar/1.0.0 returned 400 Bad Request.

If I publish an unscoped package (e.g. foo), http://localhost:8081/repository/my-npm/foo/1.0.0 does not respond with HTTP Code 400 but with 404 and body

{"success":false,"error":"Package 'foo-1.0.0' not found"}

No

GitHub's dependabot uses the /{package}/{version} endpoint to request specific package versions from npm registries. Without this endpoint dependabot cannot check nexus hosted npm repositories for updated packages.

Implement the /{package}/{version} endpoint and return version specific package information like npmjs.com does (e.g. https://registry.npmjs.com/semver/6.3.1)

I used the latest sonartype/nexus3 docker image (which should be version 3.58.1) to verify this issue.

docker run -d -p 8081:8081 --name nexus sonatype/nexus3
nblair commented 1 year ago

Hi @WIStudent thanks for opening an issue. Our support for NPM is geared towards supporting the NPM client, and it does not appear this API you've identified is required to support the NPM client. We'll leave this issue open to gauge interest from the community.

KagurazakaNyaa commented 3 weeks ago

However, the lack of this API will cause errors in some clients that are compatible with the official registry API. Can you reconsider adding this API to ensure compatibility with the official registry?