You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sourcemap inject/upload doesn't recognize a debug ID snippet minified to template literals and shifts Vite 8 chunks one line #2248
Every frame from a Vite 8 build resolves one generated line off in Sentry.
The bundler plugin injects its debug ID snippet in renderChunk, and Vite 8's minifier then rewrites the snippet's string literals as template literals:
The plugin then uploads with sourcemap.upload, which runs inject first. DEBUGID_REGISTRATION_RE only matches a value quoted with " or ':
...\\s*=\\s*(["'])(${DEBUGID_PATTERN})\\1
so the CLI doesn't see the existing registration, prepends a second snippet and adds an empty line to the map's mappings. The uploaded copy and its map agree with each other, but the deployed file doesn't have that extra line, so Sentry resolves every frame one line too high.
This is the same mechanism as #2189, with a different trigger: #2190 taught the check Turbopack's _debugIds form, but it still requires quotes.
The backreference still requires matching delimiters. The bracketed key form (\\[\\s*["']${DEBUGID_REGISTRY}["']\\s*\\]) probably wants the same, since a minifier can emit e[`_sentryDebugIds`].
We're working around it with a pnpm patch making exactly this change. With it, all of our uploaded chunks match the deployed files except for the appended //# debugId= comment, and their maps are unchanged.
This looks like a duplicate of #2267, which #2268 fixed on main (aa80347). That change makes the registration check accept backticks around the ID and around the bracketed registry name (e[`_sentryDebugIds`]), which is the fix suggested here, plus Oxc's ||= / ??= Turbopack form. It first shipped in cli@0.50.0.
The reproduction in this issue, run from source with sourcemap inject --dry-run --json, gives "modified": 0, "skipped": 1.
A real chunk built with rolldown 1.2.14 (minify: true, Oxc) and @sentry/bundler-plugins 11.12.0's rollup plugin, with the //# debugId= comment appended the way the plugin stages its upload copy: the JS is left byte-identical and mappings is unchanged. The pre-fix(cli): Recognize debug ID snippets from Oxc and React Native Metro #2268 regex finds no registration in that file.
The templateLiterals and bracketTemplateRegistry cases in packages/cli/test/lib/sourcemap/inject.test.ts cover this form for external and inline maps.
There's one related case this issue doesn't cover: a staged chunk that has the snippet but neither a //# debugId= comment nor a map ID. That's #2269, and #2270 handles it.
If you're on sentry ≥ 0.50.0, you can drop the pnpm patch. Unless you still see the shift on 0.50.0+, I think this can be closed.
Activity
linear-code commentedon Nov 13, 2026
MCP-1225
sentry-junior commentedon Nov 26, 2026
This looks like a duplicate of #2267, which #2268 fixed on
main(aa80347). That change makes the registration check accept backticks around the ID and around the bracketed registry name (e[`_sentryDebugIds`]), which is the fix suggested here, plus Oxc's||=/??=Turbopack form. It first shipped incli@0.50.0.Checked on current
main(2f5996c):sourcemap inject --dry-run --json, gives"modified": 0, "skipped": 1.minify: true, Oxc) and@sentry/bundler-plugins11.12.0's rollup plugin, with the//# debugId=comment appended the way the plugin stages its upload copy: the JS is left byte-identical andmappingsis unchanged. The pre-fix(cli): Recognize debug ID snippets from Oxc and React Native Metro #2268 regex finds no registration in that file.templateLiteralsandbracketTemplateRegistrycases inpackages/cli/test/lib/sourcemap/inject.test.tscover this form for external and inline maps.There's one related case this issue doesn't cover: a staged chunk that has the snippet but neither a
//# debugId=comment nor a map ID. That's #2269, and #2270 handles it.If you're on
sentry≥ 0.50.0, you can drop thepnpm patch. Unless you still see the shift on 0.50.0+, I think this can be closed.