fix(plugin-manager): Enable "rejectOnError" in debug#837
Conversation
| await cliInstance.execute( | ||
| ["sourcemaps", "inject", ...buildArtifactPaths], | ||
| options.debug ?? false | ||
| options.debug ? 'rejectOnError' : false |
There was a problem hiding this comment.
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.
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.
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.
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.
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
| datasource | package | from | to | | ---------- | ------------------- | ----- | ----- | | npm | @sentry/vite-plugin | 4.6.1 | 4.7.0 | ## [v4.7.0](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#470) - docs: Add RELEASE.md to document release process ([#834](getsentry/sentry-javascript-bundler-plugins#834)) - feat: Combine injection plugins ([#844](getsentry/sentry-javascript-bundler-plugins#844)) - fix(plugin-manager): Enable "rejectOnError" in debug ([#837](getsentry/sentry-javascript-bundler-plugins#837)) - fix(plugin-manager): Respect `sourcemap.ignore` values for injecting debugIDs ([#836](getsentry/sentry-javascript-bundler-plugins#836)) - fix(vite): Skip HTML injection for MPA but keep it for SPA ([#843](getsentry/sentry-javascript-bundler-plugins#843)) <details> <summary> <strong>Internal Changes</strong> </summary> - chore: Use pull\_request\_target for changelog preview ([#842](getsentry/sentry-javascript-bundler-plugins#842)) - ci(release): Switch from action-prepare-release to Craft ([#831](getsentry/sentry-javascript-bundler-plugins#831)) - test: Ensure Debug IDs match ([#840](getsentry/sentry-javascript-bundler-plugins#840)) </details> ## [v4.6.2](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#462) - fix(vite): Ensure sentryVitePlugin always returns an array of plugins ([#832](getsentry/sentry-javascript-bundler-plugins#832)) - fix(vite): Skip code injection for HTML facade chunks ([#830](getsentry/sentry-javascript-bundler-plugins#830)) - fix(rollup): Prevent double-injection of debug ID ([#827](getsentry/sentry-javascript-bundler-plugins#827)) - fix(esbuild): fix debug ID injection when moduleMetadata or applicationKey is set ([#828](getsentry/sentry-javascript-bundler-plugins#828))
| datasource | package | from | to | | ---------- | ------------------- | ----- | ----- | | npm | @sentry/vite-plugin | 4.6.1 | 4.7.0 | ## [v4.7.0](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#470) - docs: Add RELEASE.md to document release process ([#834](getsentry/sentry-javascript-bundler-plugins#834)) - feat: Combine injection plugins ([#844](getsentry/sentry-javascript-bundler-plugins#844)) - fix(plugin-manager): Enable "rejectOnError" in debug ([#837](getsentry/sentry-javascript-bundler-plugins#837)) - fix(plugin-manager): Respect `sourcemap.ignore` values for injecting debugIDs ([#836](getsentry/sentry-javascript-bundler-plugins#836)) - fix(vite): Skip HTML injection for MPA but keep it for SPA ([#843](getsentry/sentry-javascript-bundler-plugins#843)) <details> <summary> <strong>Internal Changes</strong> </summary> - chore: Use pull\_request\_target for changelog preview ([#842](getsentry/sentry-javascript-bundler-plugins#842)) - ci(release): Switch from action-prepare-release to Craft ([#831](getsentry/sentry-javascript-bundler-plugins#831)) - test: Ensure Debug IDs match ([#840](getsentry/sentry-javascript-bundler-plugins#840)) </details> ## [v4.6.2](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#462) - fix(vite): Ensure sentryVitePlugin always returns an array of plugins ([#832](getsentry/sentry-javascript-bundler-plugins#832)) - fix(vite): Skip code injection for HTML facade chunks ([#830](getsentry/sentry-javascript-bundler-plugins#830)) - fix(rollup): Prevent double-injection of debug ID ([#827](getsentry/sentry-javascript-bundler-plugins#827)) - fix(esbuild): fix debug ID injection when moduleMetadata or applicationKey is set ([#828](getsentry/sentry-javascript-bundler-plugins#828))
Enables
"rejectOnError"when debug mode is enabled