-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(core): catch all lock file parsing/pruning errors and provide fallback #15158
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -527,7 +528,13 @@ function nestMappedPackages( | |||
}); | |||
|
|||
if (initialSize === nestedNodes.size) { | |||
throw Error('Loop detected while pruning. Please report this issue.'); | |||
output.error({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this reported so low? Shouldn't we have a try catch
around parseLockFile
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error happens on pruning
and although it should not fail anymore, we still want to show error log if it does so we can track it.
This is the only remaining place we anticipate that error might occur.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should catch even unanticipated errors.
Throwing an Error here is fine. But we should catch it higher up if the whole operation is not necessary (/ there is a workaround)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be an error again right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention was to try not break the lock file creation, as even without a few packages missing the installation might still work.
But I guess it's safer to just return the root lock file.
2577caf
to
bc2ffe9
Compare
@@ -527,7 +528,13 @@ function nestMappedPackages( | |||
}); | |||
|
|||
if (initialSize === nestedNodes.size) { | |||
throw Error('Loop detected while pruning. Please report this issue.'); | |||
output.error({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should catch even unanticipated errors.
Throwing an Error here is fine. But we should catch it higher up if the whole operation is not necessary (/ there is a workaround)
@@ -527,7 +528,13 @@ function nestMappedPackages( | |||
}); | |||
|
|||
if (initialSize === nestedNodes.size) { | |||
throw Error('Loop detected while pruning. Please report this issue.'); | |||
output.error({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be an error again right?
9b4c7bb
to
492bf0c
Compare
…lback (#15158) Co-authored-by: Jason Jean <[email protected]> (cherry picked from commit 5d69c4e)
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
When npm stringification after pruning fails because some dependnecies could not be nested it throws an error, breaking the build.
Expected Behavior
Lock file stringification error should not break the build. We should rather return existing (potentially functional) lock file and notify user of potential issue and how to overcome it.
Related Issue(s)
Fixes #