Cloudflare Workflow instrumentation leaves pending waitUntil tasks after the flush timeout
@JPeer264 がすでに取り組んでいます。
2026年9月18日 から。
評価
この issue はまだ評価されていません。
説明
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/cloudflare
SDK Version
10.71.0
Framework Version
Cloudflare Workers Workflows; Wrangler 4.126.0
Link to Sentry event
No response
Reproduction Example/SDK Setup
import * as Sentry from "@sentry/cloudflare";
import { WorkflowEntrypoint } from "cloudflare:workers";
class ReproductionWorkflow extends WorkflowEntrypoint {
async run(_event, step) {
for (let index = 0; index < 100; index++) {
await step.do(`step-${index}`, async () => index);
}
}
}
export const ReproductionWorkflowWithSentry = Sentry.instrumentWorkflowWithSentry(
() => ({
// This test endpoint accepts Sentry envelopes but delays its response
// for 120 seconds.
dsn: "https://public@<delayed-endpoint>/1",
tracesSampleRate: 1,
enableLogs: false,
sendClientReports: false,
}),
ReproductionWorkflow,
);
Steps to Reproduce
- Deploy an HTTP endpoint that accepts requests and delays every response for 120 seconds.
- Configure the instrumented Workflow’s DSN to use that endpoint.
- Deploy and trigger the Workflow with 100 trivial step.do() calls.
- In Cloudflare Observability, search the Worker’s events for "tasks did not complete".
Expected Result
Sentry’s flush(2000) timeout should settle all Sentry-owned waitUntil work within two seconds, including cancelling any pending transport request. No waitUntil cancellation warning should be emitted.
Actual Result
Cloudflare emits:
"waitUntil() tasks did not complete within the allowed time after invocation end and have been cancelled."
The Workflow itself completes successfully, but Sentry-owned work remains pending after the flush timeout.
Additional Context
Investigation identified three places where the configured flush timeout was not fully enforced:
- The transport drain returned false after its timeout but did not abort the pending fetch request.
- Workflow steps reused flushPointReached from the previous step, causing later steps to register unnecessary eager waitUntil flushes.
- CloudflareClient.flush() awaited flushLock.finalize() outside the configured timeout.
We reproduced the warning in a deployed Cloudflare Workflow using a transport endpoint that delayed every response for 120 seconds. After addressing all three paths, 20/20 Workflow instances completed with zero matching warnings in Cloudflare Observability.
Each defect has a red/green regression test. The complete @sentry/cloudflare test suite passes (955/955), along with lint, build, and typecheck.
Priority
No response
- 主要言語
- TypeScript
- スター
- 8.7k
- フォーク
- 1.9k
- 平均マージ
- 1日 16時間
- マージ済み PR(30日)
- 576
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
getsentry/sentry-javascript のほかの issue
-
Browser Bug Next.js Traces Waiting for: Product Owner
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
getsentry/sentry-javascript#24672 · コメント 1 件 ·
-
Flaky Test React Router Framework Spans Tests
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
getsentry/sentry-javascript#24348 · コメント 1 件 ·
-
javascript
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
getsentry/sentry-javascript#24200 · コメント 2 件 ·
-
javascript Task
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
getsentry/sentry-javascript#24134 · コメント 1 件 ·
-
Cloudflare Workers javascript Tests
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
getsentry/sentry-javascript#24051 · コメント 1 件 ·
getsentry/sentry-javascript の issue をすべて見る
似ている issue
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
Mend: dependency security vulnerability untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100