-
Notifications
You must be signed in to change notification settings - Fork 51
fix(plugin-manager): Enable "rejectOnError" in debug #837
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
Conversation
| await cliInstance.execute( | ||
| ["sourcemaps", "inject", ...buildArtifactPaths], | ||
| options.debug ?? false | ||
| options.debug ? 'rejectOnError' : false |
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.
Bug: The execute method is called with the string 'rejectOnError' when options.debug is true, but the method's live parameter now expects a boolean.
Severity: HIGH
Suggested Fix
To align with the updated @sentry/cli API and existing tests, pass the boolean true instead of the string 'rejectOnError' when options.debug is true. The ternary expression should be options.debug ? true : false.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: packages/bundler-plugin-core/src/build-plugin-manager.ts#L558
Potential issue: The code change passes the string `'rejectOnError'` to the `execute`
method of the Sentry CLI when `options.debug` is true. However, according to the
documentation for `@sentry/cli` v2.57.0, the `live` parameter for this method was
changed to only accept a boolean value. Passing a string will cause a runtime type error
and break the debug ID injection functionality. An existing test case confirms that the
method expects a boolean `true` when the debug flag is enabled. The author likely
confused this with the `uploadSourceMaps` method, which accepts `'rejectOnError'` in its
options.
Did we get this right? 👍 / 👎 to inform future reviews.
| await cliInstance.execute( | ||
| ["sourcemaps", "inject", ...buildArtifactPaths], | ||
| options.debug ?? false | ||
| options.debug ? "rejectOnError" : false | ||
| ); |
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.
Bug: The cliInstance.execute() method is called with the string "rejectOnError" when options.debug is true, but this method's second parameter expects a boolean, which will cause a runtime error.
Severity: HIGH
Suggested Fix
Replace the ternary expression options.debug ? "rejectOnError" : false with a boolean value. The correct implementation should be !!options.debug or simply options.debug if it's guaranteed to be a boolean.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: packages/bundler-plugin-core/src/build-plugin-manager.ts#L556-L559
Potential issue: The `cliInstance.execute()` method from the `@sentry/cli` package is
called with an incorrect argument type. When `options.debug` is true, the code passes
the string `"rejectOnError"` as the second argument. However, the method's signature is
`execute(args: string[], live: boolean)`, which requires a boolean value. While the
`uploadSourceMaps` method accepts the string `"rejectOnError"`, the `execute` method
does not. This will cause a runtime error when the bundler plugin is run in debug mode,
preventing debug ID injection from succeeding.
Did we get this right? 👍 / 👎 to inform future reviews.
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.
looks like this is only true for v3 of the CLI 🤔
https://github.com/getsentry/sentry-cli/blob/2.58.4/lib/index.js#L79
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.
yeah, the default handling of live changed in v3
| await cliInstance.execute( | ||
| ["sourcemaps", "inject", ...buildArtifactPaths], | ||
| options.debug ?? false | ||
| options.debug ? "rejectOnError" : false | ||
| ); |
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.
looks like this is only true for v3 of the CLI 🤔
https://github.com/getsentry/sentry-cli/blob/2.58.4/lib/index.js#L79
Enables
"rejectOnError"when debug mode is enabled