Loader stub silently drops calls outside queued method list, which results in either silent no-ops
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- javascript, typescript
- Ambito
- frontend
Direzione di ricerca
Inizia leggendo packages/browser-integration-tests/fixtures/loader.js per tracciare la coda dei metodi pre-caricamento, quindi confronta le sue voci con l’implementazione di addIntegration in packages/core/src/integration.ts. Conferma come le chiamate accodate vengono riprodotte dopo il caricamento e verifica che la protezione scelta gestisca addIntegration senza modificare i metodi già presenti nella coda.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem Statement
Problem
The CDN loader stub only queues a fixed set of SDK methods pre-load (init, addBreadcrumb, captureMessage, captureException, captureEvent, configureScope, withScope, showReportDialog). Any SDK call outside this list — such as addIntegration — is silently absent on the window.Sentry proxy before the full bundle loads, causing either silent no-ops or runtime crashes depending on timing.
The correct workaround is wrapping such calls in Sentry.onLoad(...), but the loader provides no mechanism to enforce this, making it easy to write code that works in development (where the bundle may already be loaded) but crashes in production.
Current Behavior
- Unrecognized calls on the pre-load proxy are
undefined— calling them throws or silently does nothing addIntegrationis a notable gap: it is a common post-init call pattern that the loader stub does not queue
Gap
- No TypeScript or runtime guardrail prevents calling unqueued methods before
onLoad - The failure mode is timing-dependent and hard to reproduce locally
Solution Brainstorm
Options
- Extend the queued method list — add
addIntegration(and other commonly used post-init methods) to the pre-load queue so they are replayed after the bundle loads, consistent with howinitis handled - Catch-all no-op proxy — intercept any unrecognized property access pre-load and return a no-op function; prevents crashes but silently swallows calls
- Catch-all replay proxy — queue all unrecognized calls (not just the fixed list) and attempt replay post-load; broader coverage but requires more careful handling of methods with return values
Option 1 is the lowest-risk and most targeted fix. Option 3 is the most ergonomic for callers but adds complexity to the replay logic.
Additional Context
References
- Loader stub source:
packages/browser-integration-tests/fixtures/loader.js addIntegrationimplementation:packages/core/src/integration.ts
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.
- Lingua principale
- TypeScript
- Stelle
- 8.7k
- Fork
- 1.9k
- Merge medio
- 1g 18h
- PR unite (30g)
- 562
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di getsentry/sentry-javascript
-
Browser Waiting for: Product Owner
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
getsentry/sentry-javascript#24577 · 1 commento ·
-
Task
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
getsentry/sentry-javascript#24558 · 1 commento ·
-
Task
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
getsentry/sentry-javascript#24557 · 1 commento ·
-
Task
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
getsentry/sentry-javascript#24556 · 1 commento ·
-
Task
Difficoltà 1/5 1-3 ore Idoneità per principianti 90/100
getsentry/sentry-javascript#24555 · 1 commento ·
Tutte le issue di getsentry/sentry-javascript
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
bug v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
modelcontextprotocol/inspector#2458 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
carbon-design-system/ibm-products#9907 ·