feat(cloudflare): Derive rpcTracePropagationTargets from the wrangler config - #23491
feat(cloudflare): Derive rpcTracePropagationTargets from the wrangler config#23491JPeer264 wants to merge 1 commit into
Conversation
… config The Vite plugin already knows which bindings resolve to receivers it instruments itself: Durable Object bindings without a `script_name`, and service bindings naming this worker. Those are exactly the bindings whose trailing trace argument is guaranteed to be stripped again, so the plugin adds them to `rpcTracePropagationTargets` and same-deployment RPC traces connect without any configuration. Bindings to other workers stay opt-in. Only bindings whose receiver class the transform wrapped itself are added. A class the user wrapped by hand, or re-exported from another module, runs on its own options and cannot be assumed to strip the argument. The options object only exists once the callback runs with `env`, so the plugin cannot merge at build time. The transform emits an inline callback that wraps the user's one and merges the binding names, so no runtime helper export is needed. Note this default only applies to Vite builds. At runtime a DurableObjectNamespace exposes no origin and a Fetcher does not say which service it points at, so a plain wrangler build still has to list its bindings. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
size-limit report 📦
|
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a85e9fb. Configure here.
| // MagicString positions are always relative to the original source. | ||
| state.ms.overwrite(node.start, decl.start, 'const __SENTRY_DEFAULT_EXPORT__ = '); | ||
| state.ms.append(`\nexport default __SENTRY__.withSentry(${ctx.optionsFn}, __SENTRY_DEFAULT_EXPORT__);\n`); | ||
| state.ms.append(`\nexport default __SENTRY__.withSentry(${state.optionsFn}, __SENTRY_DEFAULT_EXPORT__);\n`); |
There was a problem hiding this comment.
Missed self-binding on default re-export
Medium Severity
When export default AlreadyWrappedClass skips wrapping because the class was already auto-wrapped as a named export, undefined is never added to autoWrapped. Entrypoint-less self service bindings use className: undefined, so they are filtered out of rpcTracePropagationTargets even though the default export is the instrumented class and would strip the trailing RPC metadata.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit a85e9fb. Configure here.


The Vite plugin already knows which bindings resolve to receivers it instruments itself: Durable Object bindings without a
script_name, and service bindings naming this worker. Those are exactly the bindings whose trailing trace argument is guaranteed to be stripped again, so the plugin adds them torpcTracePropagationTargetsand same-deployment RPC traces connect without any configuration. Bindings to other workers stay opt-in.Only bindings whose receiver class the transform wrapped itself are added. A class the user wrapped by hand, or re-exported from another module, runs on its own options and cannot be assumed to strip the argument.
The options object only exists once the callback runs with
env, so the plugin cannot merge at build time. The transform emits an inline callback that wraps the user's one and merges the binding names, so no runtime helper export is needed.Note this default only applies to Vite builds. At runtime a DurableObjectNamespace exposes no origin and a Fetcher does not say which service it points at, so a plain wrangler build still has to list its bindings.