Skip to content

Conversation

@logaretm
Copy link
Member

This PR adds an additional check to make sure we only inject debug IDs if sourcemaps are NOT disabled. The issue isn't present when sourcemaps are enabled and since debug IDs are only relevant for sourcemap correlation then this should be a safe change AFAIK.

Closes #18983

Copilot AI review requested due to automatic review settings January 27, 2026 19:45
@linear
Copy link

linear bot commented Jan 27, 2026

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue where debug IDs were being incorrectly injected into node_modules files when sourcemaps were explicitly disabled, causing compilation errors on subsequent builds. The fix adds a check to skip debug ID injection when sourcemaps.disable is set to true.

Changes:

  • Added conditional check to prevent debug ID injection when sourcemaps are explicitly disabled in Next.js production builds

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

await sentryBuildPluginManager.createRelease();

if (!usesNativeDebugIds) {
// Skip debug ID injection if sourcemaps are disabled which are only relevant for sourcemap correlation
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment's grammar is ambiguous. The phrase "which are only relevant" makes it unclear whether it refers to "sourcemaps" or "debug IDs". Consider rephrasing for clarity.

Suggested change
// Skip debug ID injection if sourcemaps are disabled which are only relevant for sourcemap correlation
// Skip debug ID injection when sourcemaps are disabled, because debug IDs are only relevant for sourcemap correlation.

Copilot uses AI. Check for mistakes.

if (!usesNativeDebugIds) {
// Skip debug ID injection if sourcemaps are disabled which are only relevant for sourcemap correlation
if (!usesNativeDebugIds && sentryBuildOptions.sourcemaps?.disable !== true) {
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding test coverage for the new conditional logic that skips debug ID injection when sourcemaps are disabled. The test should verify that injectDebugIds is not called when sentryBuildOptions.sourcemaps.disable is true, but is called when it's false or undefined. This would ensure the fix for issue #18983 remains working.

Copilot uses AI. Check for mistakes.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Copy link
Member

@chargome chargome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

@logaretm logaretm merged commit de658a8 into develop Jan 28, 2026
130 of 135 checks passed
@logaretm logaretm deleted the awad/js-1556-setting-sourcemapsdisable-to-true-results-in-compile-errors branch January 28, 2026 14:17
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.

Setting sourcemaps.disable to true results in compile errors of dependencies in node_modules

4 participants