Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export async function handleRunAfterProductionCompile(
await sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal();
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 && 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.
await sentryBuildPluginManager.injectDebugIds([distDir]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,62 @@ describe('handleRunAfterProductionCompile', () => {
});
});

describe('sourcemaps disabled', () => {
it('skips debug ID injection when sourcemaps.disable is true', async () => {
const optionsWithDisabledSourcemaps: SentryBuildOptions = {
...mockSentryBuildOptions,
sourcemaps: {
disable: true,
},
};

await handleRunAfterProductionCompile(
{
releaseName: 'test-release',
distDir: '/path/to/.next',
buildTool: 'turbopack',
},
optionsWithDisabledSourcemaps,
);

expect(mockSentryBuildPluginManager.injectDebugIds).not.toHaveBeenCalled();
expect(mockSentryBuildPluginManager.uploadSourcemaps).toHaveBeenCalled();
});

it('still injects debug IDs when sourcemaps.disable is false', async () => {
const optionsWithEnabledSourcemaps: SentryBuildOptions = {
...mockSentryBuildOptions,
sourcemaps: {
disable: false,
},
};

await handleRunAfterProductionCompile(
{
releaseName: 'test-release',
distDir: '/path/to/.next',
buildTool: 'turbopack',
},
optionsWithEnabledSourcemaps,
);

expect(mockSentryBuildPluginManager.injectDebugIds).toHaveBeenCalledWith(['/path/to/.next']);
});

it('still injects debug IDs when sourcemaps option is undefined', async () => {
await handleRunAfterProductionCompile(
{
releaseName: 'test-release',
distDir: '/path/to/.next',
buildTool: 'turbopack',
},
mockSentryBuildOptions,
);

expect(mockSentryBuildPluginManager.injectDebugIds).toHaveBeenCalledWith(['/path/to/.next']);
});
});

describe('path handling', () => {
it('correctly passes distDir to debug ID injection', async () => {
const customDistDir = '/custom/dist/path';
Expand Down
Loading