sourcemap inject/upload doesn't recognize a debug ID snippet minified to template literals and shifts Vite 8 chunks one line
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- Une demi-journée
- Accessibilité débutants
- 45/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- javascript, node.js, typescript, vite
- Domaine
- build-system, cli, devtools
Piste de recherche
Start with DEBUGID_REGISTRATION_RE and the bracketed-key regex in packages/cli/src/lib/sourcemap/debug-id.ts, which only accept " or ' as delimiters. Run the reproduction in the issue against a chunk using backtick-quoted registrations; inject --dry-run should report modified 1 today. Done when that case reports skipped 1 with the same delimiter-matching behavior as double quotes, and tests cover both the plain and bracketed forms.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Environment
sentry0.49.0, via@sentry/vite-plugin/@sentry/bundler-plugins11.12.0- Vite 8.3.8 (Rolldown, Oxc minifier),
build.sourcemap: true - The same check is on
mainat cc90ca1e
Summary
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:
e._sentryDebugIds[t]=`4f39e3c4-c308-4c2e-8975-3241d12fbeef`,e._sentryDebugIdIdentifier=`sentry-dbid-4f39e3c4-c308-4c2e-8975-3241d12fbeef`
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.
Reproduction
dir=$(mktemp -d)
cat > "$dir/chunk.js" <<'EOF'
const a=1;
(()=>{try{let e=globalThis,t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`4f39e3c4-c308-4c2e-8975-3241d12fbeef`,e._sentryDebugIdIdentifier=`sentry-dbid-4f39e3c4-c308-4c2e-8975-3241d12fbeef`)}catch{}})();console.log(a);
//# sourceMappingURL=chunk.js.map
//# debugId=4f39e3c4-c308-4c2e-8975-3241d12fbeef
EOF
echo '{"version":3,"sources":["a.ts"],"names":[],"mappings":"AAAA;AACA","debugId":"4f39e3c4-c308-4c2e-8975-3241d12fbeef"}' > "$dir/chunk.js.map"
npx [email protected] sourcemap inject --dry-run --json "$dir"
Expected: "modified": 0, "skipped": 1, as with the same file using " quotes.
Actual: "modified": 1, "skipped": 0.
Suggested fix
Accept a backtick in the quote class:
- ...\\s*=\\s*(["'])(${DEBUGID_PATTERN})\\1`,
+ ...\\s*=\\s*(["'\`])(${DEBUGID_PATTERN})\\1`,
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.
- Langage dominant
- TypeScript
- Étoiles
- 961
- Forks
- 179
- Merge moyen
- 15 h 33 min
- PR mergées (30 j)
- 476
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de getsentry/toolkit
-
MCP mcp-feedback-pattern
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
getsentry/toolkit#2276 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
CLI enhancement MCP
Difficulté 2/5 1-3 heures Accessibilité débutants 63/100
getsentry/toolkit#1908 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
getsentry/toolkit#1471 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
get_sentry_resource gives no guidance for Explore > Errors list URLsPeut-être pris @sentry-junior l’a pris aujourd’hui. OuverteMCP mcp-feedback-pattern
Difficulté 2/5 1-3 heures Accessibilité débutants 32/100
getsentry/toolkit#2278 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 3/5 1-2 jours Accessibilité débutants 65/100
getsentry/toolkit#2275 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de getsentry/toolkit
Issues similaires
-
[BUG]: Duplicate preposition in heading and unformatted feedback text on Strengthen Argument pageOuvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
AOSSIE-Org/DebateAI#801 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
ci: repo has no GitHub Actions workflow, so pushes and pull requests are never built or testedOuverteagents area: runtime automation chore cli consistency dependencies developer-experience difficulty: easy documentation enhancement good first issue help wanted hygiene json-output priority: P3 starters tests
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
Add: BOM CineOuverteapproved check:passed streams:add
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour