Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

@sentry/cloudflare: Durable Object methods called from the constructor's blockConcurrencyWhile callback are captured as untraced RPC entries

未关闭
#24,735 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
58/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript
领域
backend, cloud

调研方向

Start in durableobject.ts at the RPC prototype wrapper and its startNewTrace branch, then run the provided Store reproduction with @cloudflare/vitest-pool-workers. Trace the constructor's blockConcurrencyWhile callback and verify that a caught init error no longer produces an error event or an untraced RPC entry.

由索引模型根据 Issue 内容生成。

描述

Bug Cloudflare Workers Waiting for: Product Owner
Version

@sentry/cloudflare 10.75.1, with enableRpcTracePropagation: true

Summary

Since #24512, the RPC prototype wrapper instruments any prototype method called while the isolation scope is the default one, in a new trace. The wrapper is installed after construction, but a blockConcurrencyWhile callback started in the constructor runs after that, with no isolation scope. So a method the object calls on itself during initialisation is treated as an untraced RPC entry. If it throws, the error is captured as handled: false with mechanism auto.faas.cloudflare.durable_object, even when the object catches it.

Repro
class Store extends DurableObject {
  failure?: Error;
  constructor(ctx: DurableObjectState, env: Env) {
    super(ctx, env);
    void ctx.blockConcurrencyWhile(async () => {
      try { this.init(); } catch (e) { this.failure = e as Error; }
    });
  }
  init(): void { throw new Error('init failed'); }
  ping(): string { return this.failure ? 'degraded' : 'ok'; }
}

export const Instrumented = Sentry.instrumentDurableObjectWithSentry(
  (env) => ({ dsn: env.SENTRY_DSN, enableRpcTracePropagation: true }),
  Store,
);

Call ping() on a stub.

Expected: no error event. The error is caught inside the object.

Actual: one error event for init failed, handled: false, in its own trace.

Observed in real workerd (@cloudflare/vitest-pool-workers). With a raised Error.stackTraceLimit, the capturing frame is the untraced startNewTrace branch in durableobject.ts, wrapping the method called from the constructor's blockConcurrencyWhile callback.

Notes

Declaring internal methods as #private avoids it, because they are no longer on the prototype, and that matches Cloudflare's RPC visibility guidance (https://developers.cloudflare.com/workers/runtime-apis/rpc/visibility/). It may be worth either documenting that, or running constructor-time blockConcurrencyWhile callbacks inside an isolation scope so they are not mistaken for RPC entries.

主要语言
TypeScript
星标
8.7k
派生
1.9k
平均合并
1 天 15 小时
30 天内合并 PR
523

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

getsentry/sentry-javascript 的其他 Issue

查看 getsentry/sentry-javascript 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。