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
Vite auto-instrumentation renames wrapped classes, mangling span names #24696
Under zero config (sentryCloudflareVitePlugin()), a wrapped class reports its name as __SENTRY_ORIGINAL_<Name>__ at runtime. Anything that reads Class.name shows that placeholder: a @cloudflare/think agent span reads invoke_agent __SENTRY_ORIGINAL_ThinkAgent__ with gen_ai.function_id to match, and agents puts it in gen_ai.agent.name. Applies to every class the plugin wraps (Durable Objects, Agents, Workflows, WorkerEntrypoints). Manual instrument*WithSentry is unaffected.
Root cause
packages/cloudflare/src/vite/transform.ts frees the export binding for the wrapper by renaming the user's class declaration:
Renaming a declaration changes Function.prototype.name. Think passes this.constructor.name to the AI SDK as functionId, which the vercel-ai subscriber uses as the span name.
Fix: leave the declaration alone and alias the export instead, the shape the plugin already emits for cross-module re-exports and the docs show for manual wrapping:
Activity
linear-code commentedon Sep 24, 2026
JS-3785
fix(cloudflare): Keep the user's class name when auto-wrapping an exp…
github-actions commentedon Sep 28, 2026
A PR closing this issue has just been released 🚀
This issue was referenced by PR #24700, which was included in the 11.1.0 release.