Skip to content

Cloudflare Agent RPC proxy breaks native private fields #23040

Description

@sergical

SDK

@sentry/cloudflare 10.69.0 with Cloudflare Agents 0.20.1.

Reproduction

  1. Wrap a supervisor Agent with instrumentAgentWithSentry and set enableRpcTracePropagation: true.
  2. Address either a top-level Agent with getAgentByName() or a child with native Durable Object facets (ctx.facets.get()), as Agents SDK subAgent() does.
  3. Let the Agents SDK bootstrap the instance through native Durable Object RPC (setName()).

Facets and direct RPC on their Durable Object-style stubs are documented Cloudflare runtime behavior: https://developers.cloudflare.com/dynamic-workers/usage/durable-object-facets/

Expected

Native Agent/facet/DO RPC invokes the method with the underlying Durable Object instance as its receiver.

Actual

Sentry returns a proxy from finalizeWithRpcInstrumentation, and native RPC invokes the prototype method with that proxy as this. Any native private field access then fails. PartyServer's setName() exposes this concretely through its #_name field:

TypeError: Cannot read private member #_name from an object whose class did not declare it

Setting enableRpcTracePropagation: false avoids the error.

Metadata

Metadata

Assignees

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions