Environment
@sentry/cloudflare: 10.46.0agents: 0.9.0 (Cloudflare Agents SDK)wrangler: 4.78.0
Description
instrumentDurableObjectWithSentry() wraps a Durable Object class in a way that breaks @callable() decorator metadata from the Cloudflare Agents SDK. The Agents SDK's RPC dispatcher cannot find callable methods on the wrapped class, returning "Method <name> is not callable" for any @callable() decorated method.
All @callable() methods on the class stop working after wrapping — this is not specific to any single method.
Relevant docs
Reproduction
import{callable}from'agents'import{AIChatAgent}from'@cloudflare/ai-chat'import*asSentryfrom'@sentry/cloudflare'classMyAgentBaseextendsAIChatAgent<Env,State>{
@callable()asyncsetMode(mode: string){/* ... */}
@callable()asyncstopStream(){/* ... */}}// ✅ Without wrapper — all @callable() methods work via RPCexportconstMyAgent=MyAgentBase// ❌ With wrapper — all @callable() methods return "not callable"exportconstMyAgent=Sentry.instrumentDurableObjectWithSentry((env)=>({dsn: '...'}),MyAgentBase,)Client-side (using Agents SDK useAgent):
Error: Method setMode is not callable
Expected
instrumentDurableObjectWithSentry should preserve @callable() metadata so the Agents SDK RPC dispatcher can discover decorated methods on the wrapped class.
Notes
- Standard DurableObject subclasses (non-Agents SDK) work fine with the wrapper
- The issue is specifically with the Agents SDK's
@callable() decorator which uses TC39 standard decorators (not TypeScript legacy decorators) to register methods for WebSocket RPC discovery - The wrapper likely needs to forward decorator metadata or prototype chain from the original class
Environment
@sentry/cloudflare: 10.46.0agents: 0.9.0 (Cloudflare Agents SDK)wrangler: 4.78.0Description
instrumentDurableObjectWithSentry()wraps a Durable Object class in a way that breaks@callable()decorator metadata from the Cloudflare Agents SDK. The Agents SDK's RPC dispatcher cannot find callable methods on the wrapped class, returning"Method <name> is not callable"for any@callable()decorated method.All
@callable()methods on the class stop working after wrapping — this is not specific to any single method.Relevant docs
@callable()decorator — Cloudflare Agents SDK — mechanism for exposing RPC methods on Durable Objects via WebSocketinstrumentDurableObjectWithSentry— Sentry docs — Sentry's DO wrapperReproduction
Client-side (using Agents SDK
useAgent):Expected
instrumentDurableObjectWithSentryshould preserve@callable()metadata so the Agents SDK RPC dispatcher can discover decorated methods on the wrapped class.Notes
@callable()decorator which uses TC39 standard decorators (not TypeScript legacy decorators) to register methods for WebSocket RPC discovery