Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-14473

Artifactory encounters a serialization error when retrieving an npm package

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 5.4.1, 5.4.2, 5.4.4
    • Fix Version/s: 5.4.6
    • Component/s: NPM
    • Labels:
      None
    • Environment:

      Artifactory Pro 5.4.1
      Jenkins 2.67
      NodeJS 6.9.4
      npm 4.6.1
      Centos 6.9

    • Sprint:
      Leap 16, Leap 17

      Description

      We have a virtual repository (npm-repo) that includes our local Artifactory npm registry and a remote repository pointed to https://registry.npmjs.org/. When using the virtual repository as the npm registry the following npm command fails.

      npm -dd install deep-diff --registry https://<ARTIFACTORYSERVER>/artifactory/api/npm/npm-repo
      

      The npm output is

      npm -dd install deep-diff --registry https://<ARTIFACTORYSERVER>/artifactory/api/npm/npm-repo
      npm info it worked if it ends with ok
      npm verb cli [ '/srv/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_v6_/bin/node',
      npm verb cli   '/srv/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_v6_/bin/npm',
      npm verb cli   '-dd',
      npm verb cli   'install',
      npm verb cli   'deep-diff',
      npm verb cli   '--registry',
      npm verb cli   'https://<ARTIFACTORYSERVER>/artifactory/api/npm/npm-repo' ]
      npm info using npm@4.6.1
      npm info using node@v6.9.4
      npm verb request uri https://<ARTIFACTORYSERVER>/artifactory/api/npm/npm-repo/deep-diff
      npm verb request no auth needed
      npm info attempt registry request try #1 at 5:12:05 PM
      npm verb request id fdcda9fde57da939
      npm http request GET https://<ARTIFACTORYSERVER>/artifactory/api/npm/npm-repo/deep-diff
      npm http 404 https://<ARTIFACTORYSERVER>/artifactory/api/npm/npm-repo/deep-diff
      npm verb headers { server: 'nginx/1.12.0',
      npm verb headers   date: 'Wed, 28 Jun 2017 00:12:05 GMT',
      npm verb headers   'content-type': 'application/json',
      npm verb headers   'transfer-encoding': 'chunked',
      npm verb headers   connection: 'keep-alive',
      npm verb headers   'x-artifactory-id': 'ed16c43155687871:-68e9a55f:15ce26985ab:-8000' }
      npm verb stack Error: 404 Not Found: artifactory
      npm verb stack     at makeError (/srv/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_v6_/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:308:12)
      npm verb stack     at CachingRegistryClient.<anonymous> (/srv/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_v6_/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:294:14)
      npm verb stack     at Request._callback (/srv/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_v6_/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:216:14)
      npm verb stack     at Request.self.callback (/srv/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_v6_/lib/node_modules/npm/node_modules/request/request.js:188:22)
      npm verb stack     at emitTwo (events.js:106:13)
      npm verb stack     at Request.emit (events.js:191:7)
      npm verb stack     at Request.<anonymous> (/srv/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_v6_/lib/node_modules/npm/node_modules/request/request.js:1171:10)
      npm verb stack     at emitOne (events.js:96:13)
      npm verb stack     at Request.emit (events.js:188:7)
      npm verb stack     at IncomingMessage.<anonymous> (/srv/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_v6_/lib/node_modules/npm/node_modules/request/request.js:1091:12)
      npm verb stack     at IncomingMessage.g (events.js:291:16)
      npm verb stack     at emitNone (events.js:91:20)
      npm verb stack     at IncomingMessage.emit (events.js:185:7)
      npm verb stack     at endReadableNT (_stream_readable.js:974:12)
      npm verb stack     at _combinedTickCallback (internal/process/next_tick.js:74:11)
      npm verb stack     at process._tickCallback (internal/process/next_tick.js:98:9)
      npm verb statusCode 404
      npm verb pkgid artifactory
      npm verb cwd /srv/jenkins/workspace/TEMPY4
      npm verb Linux 2.6.32-696.1.1.el6.x86_64
      npm verb argv "/srv/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_v6_/bin/node" "/srv/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_v6_/bin/npm" "-dd" "install" "deep-diff" "--registry" "https://<ARTIFACTORYSERVER>/artifactory/api/npm/npm-repo"
      npm verb node v6.9.4
      npm verb npm  v4.6.1
      npm ERR! code E404
      npm ERR! 404 Not Found: artifactory
      npm ERR! 404 
      npm ERR! 404  'artifactory' is not in the npm registry.
      npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
      npm ERR! 404 
      npm ERR! 404 Note that you can also install from a
      npm ERR! 404 tarball, folder, http url, or git url.
      npm verb exit [ 1, true ]
      

      Tracing through the Artifactory logs the relevant entries appear to be the following.

      [INFO ] (o.a.r.HttpRepo      :427) - npmjs downloading https://registry.npmjs.org/deep-diff Unknown content length 
      [INFO ] (o.a.r.HttpRepo      :440) - npmjs downloaded  https://registry.npmjs.org/deep-diff 43.73 KB at 11,940.06 KB/sec
      ...
      [ERROR] (o.a.a.n.r.NpmRemoteRepoHandler:391) - Error while parsing the response of a remote npm JSON query on 'https://registry.npmjs.org/deep-diff': Can not deserialize instance of java.lang.String out of START_OBJECT token
       at [Source: org.jfrog.storage.binstore.common.ReaderTrackingInputStream@ec3ad26; line: 1, column: 725] (through reference chain: org.jfrog.repomd.npm.model.NpmPackageMetadata["versions"]->org.jfrog.repomd.npm.model.NpmMetadata["devDependencies"])
      

      Performing the same command, but omitting the --registry option allows the install to succeed. The json from https://registry.npmjs.org/deep-diff appears to be valid.

        Attachments

          Activity

            People

            • Assignee:
              shayb Shay Bagants
              Reporter:
              timothy.mcnally Tim McNally
              Assigned QA:
              Inbar Tal
            • Votes:
              5 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: