Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-24457

npm package metadata dist-tags section can be empty when merged from a group repository member group repository

    XMLWordPrintable

    Details

      Description

      Reproduce

      Create this type of NPM format repository structure:

      npm (group)
      |
      |-- npm-hosted (group)
      |   |
      |   |-- npm-releases (hosted)
      |   |
      |   `-- npm-snapshots (hosted)
      |
      `-- npm-proxy-npmjs (proxy, official registry)
      

      Then follow these instructions:

      1. create a scoped package @test/some-package with version 1.0.0-rc.1
      2. publish this package to the npm-releases repository with
        npm publish
      3. in a different directory create the same scoped package with a different version 1.0.0-rc.1-20200601210614
      4. publish this package to the npm-snapshots repository with
        npm publish
      5. in another directory try to list the dist tags for @test/some-package when logged into the npm group repository:
        npm dist-tag ls @test/some-package
        npm ERR! dist-tag ls Couldn't get dist-tag data for Result {
        npm ERR! dist-tag ls   type: 'tag',
        npm ERR! dist-tag ls   registry: true,
        npm ERR! dist-tag ls   where: undefined,
        npm ERR! dist-tag ls   raw: '@test/some-package',
        npm ERR! dist-tag ls   name: '@test/some-package',
        npm ERR! dist-tag ls   escapedName: '@test%2fsome-package',
        npm ERR! dist-tag ls   scope: '@test',
        npm ERR! dist-tag ls   rawSpec: '',
        npm ERR! dist-tag ls   saveSpec: null,
        npm ERR! dist-tag ls   fetchSpec: 'latest',
        npm ERR! dist-tag ls   gitRange: undefined,
        npm ERR! dist-tag ls   gitCommittish: undefined,
        npm ERR! dist-tag ls   hosted: undefined
        npm ERR! dist-tag ls }
        npm ERR! code E500
        npm ERR! 500 javax.servlet.ServletException: java.lang.ClassCastException: org.sonatype.nexus.repository.view.payloads.BytesPayload cannot be cast to org.sonatype.nexus.repository.view.Content - GET http://127.0.0.1:8081/repository/npm/-/package/@test%2fsome-package/dist-tags
        

      The stack trace of the exception being thrown is:

      3.22.0 example stack trace for 500 response
      java.lang.ClassCastException: org.sonatype.nexus.repository.view.payloads.BytesPayload cannot be cast to org.sonatype.nexus.repository.view.Content
      at org.sonatype.nexus.repository.npm.internal.NpmFacetUtils.lambda$7(NpmFacetUtils.java:566)
      at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
      at java.util.Iterator.forEachRemaining(Iterator.java:116)
      at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
      at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
      at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
      at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
      at org.sonatype.nexus.repository.npm.internal.NpmFacetUtils.mergeDistTagResponse(NpmFacetUtils.java:570)
      at org.sonatype.nexus.repository.npm.internal.NpmFacetUtils$mergeDistTagResponse.call(Unknown Source)
      at org.sonatype.nexus.repository.npm.internal.NpmGroupDistTagsHandler.doGet(NpmGroupDistTagsHandler.groovy:55)
      at org.sonatype.nexus.repository.group.GroupHandler.handle(GroupHandler.java:95)
      

      Expected

      • npm dist-tags command should not get 500 response
      • npm install commands which rely on dist-tags being non-empty to resolve packages should not fail to resolve the expected versions
      • avoid ClassCastException

        Attachments

          Activity

            People

            Assignee:
            mcculls Stuart McCulloch
            Reporter:
            plynch Peter Lynch
            Last Updated By:
            Wes Wannemacher
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Date of First Response:

                tigCommentSecurity.panel-title