@sentry/cloudflare: Durable Object methods called from the constructor's blockConcurrencyWhile callback are captured as untraced RPC entries
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 58/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- typescript
研究方向
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 內容生成。
描述
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
環境準備
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
getsentry/sentry-javascript 的其他 Issue
-
Next.js: basePath is concatenated onto absolute router.push hrefs, corrupting navigation transaction names可能已有人在做 @Lms24 於 3 天前認領。 未關閉Browser Bug Next.js Traces
難度 2/5 1-3 小時 新手友好度 75/100
getsentry/sentry-javascript#24672 · 2 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
javascript
難度 2/5 1-3 小時 新手友好度 75/100
getsentry/sentry-javascript#24200 · 2 則留言 ·
維護者通常 1 天內回覆
-
javascript Task
難度 2/5 1-3 小時 新手友好度 82/100
getsentry/sentry-javascript#24134 · 1 則留言 ·
維護者通常 1 天內回覆
-
Cloudflare Workers javascript Tests
難度 2/5 1-3 小時 新手友好度 78/100
getsentry/sentry-javascript#24051 · 1 則留言 ·
維護者通常 1 天內回覆
-
Bug Bun javascript
難度 2/5 1-3 小時 新手友好度 92/100
getsentry/sentry-javascript#24045 · 1 則留言 ·
維護者通常 1 天內回覆
查看 getsentry/sentry-javascript 的全部 Issue
相似的 Issue
-
resources
難度 2/5 1-3 小時 新手友好度 72/100
railmapgen/rmg-palette#2445 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 88/100
danielmiessler/LifeOS#2242 ·
維護者通常 5 天內回覆
-
good first issue hacktoberfest help wanted translation
難度 2/5 1-3 小時 新手友好度 84/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
callstackincubator/appduct#129 ·
維護者通常 1 天內回覆
-
難度 1/5 1-3 小時 新手友好度 88/100