Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 3.33.1
-
Fix Version/s: 3.34.1
-
Story Points:5
-
Epic Link:
-
Sprint:NXRM Rocket Sprint 16
Description
During migration from 2.14.13 to 3.33. Postgres, the following types of Exceptions were noticed in NXRM 3 nexus.log
2021-08-25 17:55:58,954+0000 ERROR [plan-executor-14-thread-7] admin com.sonatype.nexus.migration.repository.ProcessChangesStep - Failed processing of CREATE npmjs-internal:/examplepackage/-/examplepackage-230.0.87-test.1250.tgz, will ignore and move on. null java.lang.NullPointerException: null at com.sonatype.nexus.migration.repository.migrators.datastore.NpmRepositoryMigrator.recordMetadata(NpmRepositoryMigrator.java:127) at com.sonatype.nexus.migration.repository.migrators.RepositoryMigratorSupport.createOrUpdate(RepositoryMigratorSupport.java:151) at com.sonatype.nexus.migration.repository.migrators.RepositoryMigratorSupport.processChange(RepositoryMigratorSupport.java:131) at com.sonatype.nexus.migration.repository.RepositoryMigrator$processChange$1.call(Unknown Source) at com.sonatype.nexus.migration.repository.ProcessChangesStep$_submit_closure2.doCall(ProcessChangesStep.groovy:336) at com.sonatype.nexus.migration.repository.ProcessChangesStep$_submit_closure2.doCall(ProcessChangesStep.groovy) at sun.reflect.GeneratedMethodAccessor731.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034) at groovy.lang.Closure.call(Closure.java:420) at groovy.lang.Closure.call(Closure.java:414) at groovy.lang.Closure.run(Closure.java:501) at org.sonatype.nexus.thread.internal.MDCAwareRunnable.run(MDCAwareRunnable.java:40) at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120) at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
In NX2 logs there is corresponding:
2021-08-25 17:55:26,223+0000 WARN [qtp1218614546-546] *UNKNOWN com.sonatype.nexus.migrationagent.repository.migrators.NpmRepositoryMigrator - Path /examplepackage/-/examplepackage-230.0.87-test.1250.tgz in package examplepackage does not match a known version, skipping
Reproduce
- Start with a test package.json in a local dir that includes this valid semantic version 1.0.87-test.1250+43260ff:
{ "name": "test-package", "version": "1.0.87-test.1250+43260ff", "description": "test-package description", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "Barney Rubble <b@example.com> (http://barnyrubble.example.com/)", "keywords": [ "special", "sauce" ], "license": "ISC", "dependencies": { "date-fns": "^2.12.0", "grunt": "^1.0.0-rc1" } }
- Have an NXRM 2 instance running at with a hosted npm repo at https://localhost:8081/nexus/content/repositories/npmjs-internal - repo version 2.14.13 was used during this test.
- Configure NPM CLI with. suitable credentials
- npm publish --registry https://localhost:8081/nexus/content/repositories/npmjs-internal
- Verify the package metadata retrieved from https://localhost:8081/nexus/content/repositories/npmjs-internal/test-package only contains one version listed as 1.0.87-test.1250 ( not 1.0.87-test.1250+43260ff ) - this is expected and normal, this is exactly how the official registry behaves when deploying a package there with the same version.
- Verify the tarball URL in the package metadata refers to this URL http://localhost:8081/nexus/content/repositories/npmjs-internal/test-package/-/test-package-1230.0.87-test.1250.tgz and that downloading it works.
- Now stop NXRM, and move sonatype-work/nexus/db/npm directory aside.
- Start NXRM and manually run a rebuild hosted npm metadata task against the npmjs-internal repo.
- Now start migration to NXRM 3 (no matter Orient or NewDB) and get NullPointerException in NpmRepositoryMigrator
Expected
Diagnose the cause of the problem and prevent nullPointerException and if a non-resolvable problem, log a better message explaining what the problem is.
Attachments
Issue Links
- is caused by
-
NEXUS-28840 NX2: rebuild hosted npm metadata task can generate invalid version entries for some valid semantic versions
-
- Closed
-
- is depended on by
-
NEXUS-28816 Maven2AssetDAO PSQLException Expected command status BEGIN, got COMMIT during repo 2 to repo 3 postgreSQL migration
-
- Closed
-
- is related to
-
NEXUS-12513 invalid nexus 2.x npm packages will fail the upgrade to nexus 3.x with 500 internal server error
-
- Closed
-