-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(nextjs): Turn off debugID injection if sourcemaps are explicitly disabled #19010
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(nextjs): Turn off debugID injection if sourcemaps are explicitly disabled #19010
Conversation
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.
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 |
Copilot
AI
Jan 27, 2026
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 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.
| // 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. |
|
|
||
| if (!usesNativeDebugIds) { | ||
| // Skip debug ID injection if sourcemaps are disabled which are only relevant for sourcemap correlation | ||
| if (!usesNativeDebugIds && sentryBuildOptions.sourcemaps?.disable !== true) { |
Copilot
AI
Jan 27, 2026
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.
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.
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.
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.
chargome
left a comment
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.
Makes sense!
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