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
Cloudflare: with the cached client, a failing transport makes a Durable Object's constructor throw #26972
import*asSentryfrom'@sentry/cloudflare'classRoom{constructor(_ctx: DurableObjectState,_env: unknown){}asyncalarm(){}}constoptions=(cacheClient: boolean)=>(): Sentry.CloudflareOptions=>({dsn: 'https://public@o1.ingest.sentry.io/1',
cacheClient,transport: ()=>{thrownewError('transport unavailable')},})constCached=Sentry.instrumentDurableObjectWithSentry(options(true),Room)newCached(ctx,env)// throws: Error: transport unavailableconstPerInvocation=Sentry.instrumentDurableObjectWithSentry(options(false),Room)constroom=newPerInvocation(ctx,env)// constructsawaitroom.alarm()// throws: Error: transport unavailable
Steps to Reproduce
Instrument a Durable Object class with instrumentDurableObjectWithSentry, keeping the default cached client.
Give it a transport whose creation throws (any failure while the client is set up).
Construct the object, as the runtime does on a wake.
Measured in workerd through @cloudflare/vitest-plugin, on 11.12.0 and 11.20.0.
Expected Result
A failure inside Sentry's own setup never fails the instrumented object: the object constructs and its handlers run without Sentry.
Actual Result
With the cached client, init() runs inside the object's construction, before the class's own constructor, so the constructor throws and the runtime cannot bring the object up.
cacheClient: true (default)
cacheClient: false
Constructor
throws
constructs
First handler
(never reached)
throws
Additional Context
11.14 deprecated cacheClient and asked anyone setting cacheClient: false to say why. We set it on our Workers and Durable Objects and have moved to the cached client; this is the one gap that remained.
Our workaround: construct the class bare when the instrumented construction throws before the class's own constructor ran.
Activity
linear-code commentedon Nov 29, 2026
JS-4181
andreiborza commentedon Nov 30, 2026
Hi @webbertakken, thanks for writing in. We'll take a look.