fix(core): improve error handling in nx migrate registry fetching#34926
Merged
leosvelperez merged 1 commit intomasterfrom Mar 19, 2026
Merged
fix(core): improve error handling in nx migrate registry fetching#34926leosvelperez merged 1 commit intomasterfrom
leosvelperez merged 1 commit intomasterfrom
Conversation
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
|
View your CI Pipeline Execution ↗ for commit 17b9c95
☁️ Nx Cloud last updated this comment at |
- Always use npm for `pack` since only npm supports downloading remote
packages (pnpm/yarn/bun pack the local project)
- Throw on install fallback failure instead of returning empty object
which caused undefined version propagation ("Fetching nx@undefined")
- Log registry fetch errors at verbose level for debuggability
c13c1dd to
17b9c95
Compare
AgentEnder
approved these changes
Mar 19, 2026
FrozenPandaz
pushed a commit
that referenced
this pull request
Mar 20, 2026
…4926) ## Current Behavior Several issues in `nx migrate` registry fetching cause confusing errors: - `packageRegistryPack` uses `pnpm pack` for pnpm users, but `pnpm pack` only packs the local project (unlike `npm pack` which downloads remote packages). This silently fails for all pnpm users, always falling back to the slower install path. - On Windows, `extractFileFromTarball` fails because `join('package', migrationsFilePath)` produces backslash paths that don't match forward-slash tarball entries. - When the install fallback also fails, `getPackageMigrationsUsingInstall` returns `{}` instead of throwing. The missing `version` property (`undefined`) propagates through `packageUpdates` and `collectedVersions`, producing `Fetching nx@undefined`. - The install fallback can fail on peer dependency conflicts since `legacy-peer-deps` was removed as a default (PR #33014), even though the install only needs files on disk (not a valid dependency tree). - The `.catch()` in `fetchMigrations` swallows errors without logging, making it impossible to diagnose registry fetch failures. ## Expected Behavior - `packageRegistryPack` always uses `npm pack` since it's the only package manager that supports downloading remote packages - Tarball entry matching uses `joinPathFragments` to normalize paths (forward slashes) for cross-platform compatibility - `getPackageMigrationsUsingInstall` throws on failure with a descriptive error instead of returning an empty object - Install fallback sets `npm_config_legacy_peer_deps=true` since it only needs files on disk, not a valid dependency tree - Registry fetch errors are logged at verbose level (`NX_VERBOSE_LOGGING=true`) for debuggability ## Related Issue(s) Fixes #33135
FrozenPandaz
pushed a commit
that referenced
this pull request
Mar 20, 2026
…4926) ## Current Behavior Several issues in `nx migrate` registry fetching cause confusing errors: - `packageRegistryPack` uses `pnpm pack` for pnpm users, but `pnpm pack` only packs the local project (unlike `npm pack` which downloads remote packages). This silently fails for all pnpm users, always falling back to the slower install path. - On Windows, `extractFileFromTarball` fails because `join('package', migrationsFilePath)` produces backslash paths that don't match forward-slash tarball entries. - When the install fallback also fails, `getPackageMigrationsUsingInstall` returns `{}` instead of throwing. The missing `version` property (`undefined`) propagates through `packageUpdates` and `collectedVersions`, producing `Fetching nx@undefined`. - The install fallback can fail on peer dependency conflicts since `legacy-peer-deps` was removed as a default (PR #33014), even though the install only needs files on disk (not a valid dependency tree). - The `.catch()` in `fetchMigrations` swallows errors without logging, making it impossible to diagnose registry fetch failures. ## Expected Behavior - `packageRegistryPack` always uses `npm pack` since it's the only package manager that supports downloading remote packages - Tarball entry matching uses `joinPathFragments` to normalize paths (forward slashes) for cross-platform compatibility - `getPackageMigrationsUsingInstall` throws on failure with a descriptive error instead of returning an empty object - Install fallback sets `npm_config_legacy_peer_deps=true` since it only needs files on disk, not a valid dependency tree - Registry fetch errors are logged at verbose level (`NX_VERBOSE_LOGGING=true`) for debuggability ## Related Issue(s) Fixes #33135
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current Behavior
Several issues in
nx migrateregistry fetching cause confusing errors:packageRegistryPackusespnpm packfor pnpm users, butpnpm packonly packs the local project (unlikenpm packwhich downloads remote packages). This silently fails for all pnpm users, always falling back to the slower install path.extractFileFromTarballfails becausejoin('package', migrationsFilePath)produces backslash paths that don't match forward-slash tarball entries.getPackageMigrationsUsingInstallreturns{}instead of throwing. The missingversionproperty (undefined) propagates throughpackageUpdatesandcollectedVersions, producingFetching nx@undefined.legacy-peer-depswas removed as a default (PR fix(misc)!: don't set legacy-peer-deps by default #33014), even though the install only needs files on disk (not a valid dependency tree)..catch()infetchMigrationsswallows errors without logging, making it impossible to diagnose registry fetch failures.Expected Behavior
packageRegistryPackalways usesnpm packsince it's the only package manager that supports downloading remote packagesjoinPathFragmentsto normalize paths (forward slashes) for cross-platform compatibilitygetPackageMigrationsUsingInstallthrows on failure with a descriptive error instead of returning an empty objectnpm_config_legacy_peer_deps=truesince it only needs files on disk, not a valid dependency treeNX_VERBOSE_LOGGING=true) for debuggabilityRelated Issue(s)
Fixes #33135