Skip to content

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

Description

@rodolfoBee

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

10.38.0

Framework Version

"next": "15.3.2",     "react": "^19.0.0",

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

  1. Create a nextJS app
  2. Install the Sentry SDK
  3. add the following to next.config.js:
sourcemaps:{
  deleteSourcemapsAfterUpload:true,
},
  1. Build the app with next build

Expected Result

All sourcemaps produced by the build are deleted after upload

Actual Result

Source maps in .next/server/** are not deleted:

Image

Additional Context

Same issue as reported here for the CSS folder: #18125

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Activity

  1. linear commented on Feb 9, 2026

    @linear
  2. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Feb 9, 2026
  3. self-assigned this
    on Feb 9, 2026
  4. s1gr1d commented on Feb 10, 2026

    @s1gr1d
    Member

    Hi, there has been an issue with this previously so the source maps are not deleted anymore on the server: #13099

    The paths can explicitly be set with an array of globs in filesToDeleteAfterUpload. Make sure to enable hidden source maps (devtool = 'hidden-source-map') in case you want to delete them. Otherwise, a sourceMappingUrl comment is added to each file which will look for the source map source - and this leads to this error of not finding the source map.

  5. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Feb 10, 2026
  6. assigned and unassigned on Feb 10, 2026
  7. peter-knips commented on Feb 11, 2026

    @peter-knips

    @s1gr1d Thank you for the answer 😄 The Sentry docs state that the source maps are deleted to better the security, does keeping the source maps in the server folder impact the security, or is this point only relevant for the files the client loads?

  8. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Feb 11, 2026
  9. 6 remaining items

  10. moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 3on Feb 12, 2026
  11. peter-knips commented on Feb 12, 2026

    @peter-knips

    @chargome Hey 😄 Ah, I see, thank you! Probably all good then. If we want to remove them, can I just do so after the npm run build has finished? We probably will just keep them. Just thinking in terms of any kind of vulnerability or misconfiguration that could cause these files to be read by 3rd parties. I mean they would get the code anyway in that case, but it would be easier to read 😊

  12. chargome commented on Feb 12, 2026

    @chargome
    Member

    Yes you can either use filesToDeleteAfterUpload once #19280 is released or just delete them yourself manually. And yes as you correctly pointed out it would require a separate vulnerability to access these files on server and then source maps for sure would not be your biggest concern 😄

  13. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Feb 12, 2026
  14. peter-knips commented on Feb 13, 2026

    @peter-knips

    @chargome Sounds good! Thanks for the great support! 😄

  15. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Feb 13, 2026
  16. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Feb 13, 2026
  17. github-actions commented on Feb 24, 2026

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #19280, which was included in the 10.40.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions