Title: @sentry/nuxt: maps removed by filesToDeleteAfterUpload stay in Nitro's public-asset manifest, so /_nuxt/*.js.map returns 500 instead of 404 · Issue #25242 · getsentry/sentry-javascript · GitHub
Open Graph Title: @sentry/nuxt: maps removed by filesToDeleteAfterUpload stay in Nitro's public-asset manifest, so /_nuxt/*.js.map returns 500 instead of 404 · Issue #25242 · getsentry/sentry-javascript
X Title: @sentry/nuxt: maps removed by filesToDeleteAfterUpload stay in Nitro's public-asset manifest, so /_nuxt/*.js.map returns 500 instead of 404 · Issue #25242 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues (related: #13632, #13993; neither covers the manifest) I have reviewed the documentation I am using the latest SDK release How do you use Sentry? Sentry SaaS (sentry...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues (related: #13632, #13993; neither covers the manifest) I have reviewed the documentation I am using the latest SDK release Ho...
X Description: Is there an existing issue for this? I have checked for existing issues (related: #13632, #13993; neither covers the manifest) I have reviewed the documentation I am using the latest SDK release Ho...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/25242
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"@sentry/nuxt: maps removed by filesToDeleteAfterUpload stay in Nitro's public-asset manifest, so /_nuxt/*.js.map returns 500 instead of 404","articleBody":"### Is there an existing issue for this?\n\n- [x] I have checked for existing issues (related: #13632, #13993; neither covers the manifest)\n- [x] I have reviewed the documentation\n- [x] I am using the latest SDK release\n\n### How do you use Sentry?\n\nSentry SaaS (sentry.io)\n\n### Which SDK are you using?\n\n@sentry/nuxt\n\n### SDK Version\n\n11.6.0 (also reproduced on 10.75.0)\n\n### Framework Version\n\nNuxt 3.21.11, nitropack 2.13.4, `node-server` preset, Node 22\n\n### Link to Sentry event\n\nn/a\n\n### Reproduction Example/SDK Setup\n\n```ts\n// nuxt.config.ts\nexport default defineNuxtConfig({\n modules: ['@sentry/nuxt/module'],\n sourcemap: { client: 'hidden' },\n sentry: {\n org: '...',\n project: '...',\n sourcemaps: {\n filesToDeleteAfterUpload: ['.output/public/**/*.map'],\n },\n },\n});\n```\n\nNo auth token is needed to reproduce, because the deletion runs either way.\n\n### Steps to Reproduce\n\n1. `nuxt build`\n2. `find .output/public -name '*.map'` finds nothing, because the maps were deleted.\n3. `grep -o '\"/_nuxt/[^\"]*\\.js\\.map\"' .output/server/chunks/nitro/nitro.mjs | head` still lists every map in Nitro's public-asset manifest.\n4. `node .output/server/index.mjs`\n5. Request a real chunk with `curl -i localhost:3000/_nuxt/\u003cchunk>.js`, then the same URL with `.map` appended: `curl -i localhost:3000/_nuxt/\u003cchunk>.js.map`.\n\n### Expected Result\n\nThe `.map` request returns 404, the same as an unknown path (`/_nuxt/doesnotexist.js.map` already returns 404).\n\n### Actual Result\n\nThe `.map` request returns 500, with the server log showing:\n\n```\n[request error] [unhandled] [GET] http://localhost:3000/_nuxt/\u003cchunk>.js.map\n H3Error: ENOENT: no such file or directory, open '.../.output/public/_nuxt/\u003cchunk>.js.map'\n```\n\nThe 500 response also carries the deleted file's ETag, its `Content-Length`, and `Cache-Control: public, max-age=31536000, immutable`, all taken from the stale manifest entry.\n\n### Additional Context\n\nOrdering problem:\n\n1. `@nuxt/nitro-server` copies the client build into `.output/public` in Nitro's `rollup:before` hook (`dist/index.mjs:780-783`: `copyPublicAssets`, then `nitro:build:public-assets`).\n2. Nitro then globs `.output/public` into the virtual `#nitro-internal-virtual/public-assets-data` manifest (`nitropack/dist/rollup/index.mjs` ~L1232) and bundles it into the server.\n3. `@sentry/nuxt` deletes the files in Nuxt's `close` hook, after the server bundle exists (`build/module/module.mjs` L620-623 in 11.6.0, `deleteSourceMapsAfterBuild`).\n4. At runtime the static handler finds the manifest entry, sets headers, and calls `readAsset`, which runs `fsp.readFile` and throws ENOENT. That surfaces as a 500 (`nitropack/dist/runtime/internal/static.mjs`).\n\nThe automatic deletion fallback (when `filesToDeleteAfterUpload` is unset) uses the same `close` hook, so it should behave the same way.\n\n`hidden` maps (#13993) stop browsers from requesting maps, but crawlers and scanners still request them. They get 500s, and Sentry's own server SDK reports those 500s as errors. Another project diagnosed the same chain independently after a bot requested about 47 maps and triggered an alert burst (kodes-agency/reputation-key#631).\n\nWorkaround we use, which removes the maps after the copy and before the manifest is built:\n\n```ts\nhooks: {\n async 'nitro:build:public-assets'(nitro) {\n const { readdir, rm } = await import('node:fs/promises');\n const { join } = await import('node:path');\n const dir = nitro.options.output.publicDir;\n const files = await readdir(dir, { recursive: true });\n await Promise.all(files.filter(f => f.endsWith('.map')).map(f => rm(join(dir, f))));\n },\n},\n```\n\nThe client upload is unaffected because the Vite plugin uploads from `.nuxt/dist/client` at `writeBundle`, before Nitro runs. We confirmed in production that the upload succeeds and the URLs return 404. `nitro.ignore: ['**/*.map']` does not work, because Nuxt appends `!\u003cbuildDir>/dist/client/_nuxt/**/*` to `nitro.ignore` (`@nuxt/nitro-server/dist/index.mjs:400`).\n\n**Suggested fix:** for client maps, have the module delete in `nitro:build:public-assets` (or exclude `*.map` when Nitro builds the manifest) instead of in `close`. Server maps can keep the current timing.\n\n### Priority\n\nLow. Nothing leaks, but it produces stray 500s and alert noise.\n","author":{"url":"https://github.com/mketiku","@type":"Person","name":"mketiku"},"datePublished":"2026-10-09T17:21:42Z","url":"https://github.com/getsentry/sentry-javascript/issues/25242"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5fd58698-641f-ffa7-7e5d-d286052fb0f8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E344:1F2E:59E09D:7BD474:6B0455C1 |
| html-safe-nonce | f2690cfc12698286b9d68b62c78c4bea1eb3ac20777b0c01c9b0e35c1a047f39 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzQ0OjFGMkU6NTlFMDlEOjdCRDQ3NDo2QjA0NTVDMSIsInZpc2l0b3JfaWQiOiI0MDk2ODA1NjUwMDE1OTk5NDI1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6667c874fa4836b1ca81050595f1306ee53e36bed7f8de02d8baa8efe170577f |
| hovercard-subject-tag | issue:5782009209 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/25242/issue_layout |
| twitter:image | https://opengraph.githubassets.com/71f1316cf22e8f4a403262a83be8a8b5c7111cc39c799f39d538f2d06768ad17/getsentry/sentry-javascript/issues/25242 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/71f1316cf22e8f4a403262a83be8a8b5c7111cc39c799f39d538f2d06768ad17/getsentry/sentry-javascript/issues/25242 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues (related: #13632, #13993; neither covers the manifest) I have reviewed the documentation I am using the latest SDK release Ho... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mketiku |
| hostname | github.com |
| expected-hostname | github.com |
| None | 910ca0e260cfec6aff11407d8dc6a0d3a4cd381a2ec9ada56627b063426892a0 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e086f9b7e88322eb2b41885a6ad425b215737fa5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width