Skip to content

Comments

feat(nextjs): Add sourcemaps.filesToDeleteAfterUpload as a top-level option#19280

Merged
chargome merged 5 commits intodevelopfrom
cg/JS-1665/deletesourcemapsafterupload-true-does-not-delete-nextserver-source
Feb 13, 2026
Merged

feat(nextjs): Add sourcemaps.filesToDeleteAfterUpload as a top-level option#19280
chargome merged 5 commits intodevelopfrom
cg/JS-1665/deletesourcemapsafterupload-true-does-not-delete-nextserver-source

Conversation

@chargome
Copy link
Member

  • Adds sourcemaps.filesToDeleteAfterUpload to the Next.js SDK's SentryBuildOptions type, allowing users to specify custom glob patterns for
    source map deletion after upload.
  • When set, this option overrides the default deletion patterns computed by deleteSourcemapsAfterUpload, giving users fine-grained control — including the ability to target server-side source maps if desired.

closes #19235

@chargome chargome self-assigned this Feb 11, 2026
@linear
Copy link

linear bot commented Feb 11, 2026

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

Codecov Results 📊


Generated by Codecov Action


if (sentryBuildOptions.debug && userFilesToDeleteAfterUpload !== undefined) {
// eslint-disable-next-line no-console
console.debug('[@sentry/nextjs] Skipping auto-deletion of source maps as user has provided filesToDeleteAfterUpload:', userFilesToDeleteAfterUpload);
Copy link

Choose a reason for hiding this comment

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

Debug log misleadingly implies deletion is skipped entirely

Low Severity

The debug log message says "Skipping auto-deletion of source maps as user has provided filesToDeleteAfterUpload" which implies deletion is being skipped. In reality, the user's custom filesToDeleteAfterUpload patterns will be used to delete files — it's only the auto-computed patterns that are skipped. A user debugging with debug: true could misinterpret this as "no deletion is happening" when files are indeed being deleted using their custom patterns. The log was specifically requested to help users understand what patterns are being used, but it focuses on what's skipped rather than what's happening.

Fix in Cursor Fix in Web

@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,005 - 9,512 -5%
GET With Sentry 1,700 19% 1,616 +5%
GET With Sentry (error only) 6,130 68% 6,033 +2%
POST Baseline 1,152 - 1,197 -4%
POST With Sentry 561 49% 590 -5%
POST With Sentry (error only) 1,044 91% 1,051 -1%
MYSQL Baseline 3,269 - 3,335 -2%
MYSQL With Sentry 436 13% 464 -6%
MYSQL With Sentry (error only) 2,624 80% 2,689 -2%

View base workflow run

@chargome chargome enabled auto-merge (squash) February 13, 2026 08:12
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.

buildTool,
deleteSourcemapsAfterUpload,
useRunAfterProductionCompileHook,
);
Copy link

Choose a reason for hiding this comment

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

User patterns bypass deleteSourcemapsAfterUpload: false guard

Medium Severity

When filesToDeleteAfterUpload is provided, it completely bypasses the deleteSourcemapsAfterUpload check. If a user sets deleteSourcemapsAfterUpload: false alongside filesToDeleteAfterUpload, source maps will still be deleted — contradicting the user's explicit opt-out. The deleteSourcemapsAfterUpload: false setting is expected to act as a master toggle preventing all deletion.

Fix in Cursor Fix in Web

@chargome chargome merged commit eb4382c into develop Feb 13, 2026
68 checks passed
@chargome chargome deleted the cg/JS-1665/deletesourcemapsafterupload-true-does-not-delete-nextserver-source branch February 13, 2026 08:30
chargome added a commit to getsentry/sentry-docs that referenced this pull request Feb 20, 2026
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.

deleteSourcemapsAfterUpload: true does not delete .next/server/** source maps

3 participants