Skip to content

Conversation

@s1gr1d
Copy link
Member

@s1gr1d s1gr1d commented Jan 15, 2026

Enables "rejectOnError" when debug mode is enabled

@s1gr1d s1gr1d requested review from Lms24 and chargome January 15, 2026 11:02
await cliInstance.execute(
["sourcemaps", "inject", ...buildArtifactPaths],
options.debug ?? false
options.debug ? 'rejectOnError' : false
Copy link

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.

Comment on lines 556 to 559
await cliInstance.execute(
["sourcemaps", "inject", ...buildArtifactPaths],
options.debug ?? false
options.debug ? "rejectOnError" : false
);
Copy link

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.

Copy link
Member

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

Copy link
Member Author

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

Comment on lines 556 to 559
await cliInstance.execute(
["sourcemaps", "inject", ...buildArtifactPaths],
options.debug ?? false
options.debug ? "rejectOnError" : false
);
Copy link
Member

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

@s1gr1d s1gr1d merged commit 8b93465 into main Jan 15, 2026
24 checks passed
@s1gr1d s1gr1d deleted the sig/fix-debug-mode branch January 15, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants