You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During nx release publish execution and when there is only one version of the specified package on the remote registry, npm dist-tag add ${packageName}@${packageJson.version} ${tag} --"${registryConfigKey}=${registry}" is executed against a package version which does not exist in the registry.
In our case, it leads to an "unhandled" 400 error when it's executed with dist-tag "latest" on Sonatype Nexus Repository OSS 3.55.0-01.
Expected Behavior
When the current package version to publish is not found on the remote registry, nx release publish should not try to execute the command npm dist-tag add ${packageName}@${packageJson.version} ${tag} --"${registryConfigKey}=${registry}" and error out.
GitHub Repo
No response
Steps to Reproduce
Create a new package in an nx workspace and update package.json version of the package to "0.1.0-beta.0"
Execute nx release publish --tag=latest
Update the created package package.json version to "0.1.0"
The issue comes from the return type of the npm view command which is not consistent for the parsed "versions" key.
"versions" key return an array of string when there is more than one version published to the remote registry and a simple string while there is still only one version.
Hence if the versions key contains for example "0.1.0-beta.0" and i'am trying to publish "0.1.0", this part of the code:
Thank you for the write up @Bare1337, SMH at the different data type depending on the length... but I can indeed reproduce using a local verdaccio registry:
Well, i have to admit you cannot and should NOT expect your return type is depending on the length... Thanks for your reactivity normalize it on your side tho.
Current Behavior
During nx release publish execution and when there is only one version of the specified package on the remote registry,
npm dist-tag add ${packageName}@${packageJson.version} ${tag} --"${registryConfigKey}=${registry}"
is executed against a package version which does not exist in the registry.In our case, it leads to an "unhandled" 400 error when it's executed with dist-tag "latest" on Sonatype Nexus Repository OSS 3.55.0-01.
Expected Behavior
When the current package version to publish is not found on the remote registry, nx release publish should not try to execute the command
npm dist-tag add ${packageName}@${packageJson.version} ${tag} --"${registryConfigKey}=${registry}"
and error out.GitHub Repo
No response
Steps to Reproduce
Nx Report
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
The issue comes from the return type of the npm view command which is not consistent for the parsed "versions" key.
"versions" key return an array of string when there is more than one version published to the remote registry and a simple string while there is still only one version.
Hence if the versions key contains for example "0.1.0-beta.0" and i'am trying to publish "0.1.0", this part of the code:
nx/packages/js/src/executors/release-publish/release-publish.impl.ts
Line 113 in 7088b09
return true as it's a substring match.
We fixed it by preemptively adding a type check and reassigning the string value into an array before the check is executed.
I'am willing to submit a PR if necessary.
The text was updated successfully, but these errors were encountered: