[Cloudflare] instrumentWorkflowWithSentry does not capture a NonRetryableError thrown before the final attempt

オープン 初心者向け
#26,091 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript

調査の方向性

まず instrumentWorkflowWithSentry と WrappedWorkflowStep.do を読み、特に現在は試行回数に応じてキャプチャの有無が決まる instrumentedCallback を確認してください。既存の Cloudflare workflow instrumentation のテストを確認し、最後の再試行より前にスローされる NonRetryableError のテストを追加してください。このエラーによって Sentry イベントが 1 件発生し、再試行を使い切った場合の動作も引き続きテストでカバーされていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Bug Cloudflare Workers
Is there an existing issue for this?

Related: #17421, #21025

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/cloudflare

SDK Version

11.9.0 (the code is the same in 11.10.0 and on develop)

Framework Version

wrangler 4.98.0, compatibility_date 2025-06-04

Reproduction Example/SDK Setup
import { WorkflowEntrypoint } from 'cloudflare:workers'
import { NonRetryableError } from 'cloudflare:workflows'
import * as Sentry from '@sentry/cloudflare'

class MyWorkflow extends WorkflowEntrypoint<Env, Params> {
  async run(event, step) {
    await step.do('load', { retries: { limit: 2, delay: '1 second' } }, async () => {
      throw new NonRetryableError('permanent failure')
    })
  }
}

export const Instrumented = Sentry.instrumentWorkflowWithSentry(
  (env) => ({ dsn: env.SENTRY_DSN }),
  MyWorkflow,
)
Steps to Reproduce
  1. Wrap a Workflow with instrumentWorkflowWithSentry.
  2. Throw a NonRetryableError in a step.do with retries.limit > 0.
  3. Trigger an instance.
Expected Result

One Sentry event for the NonRetryableError that ends the instance.

Actual Result

No event. WrappedWorkflowStep.do only captures when attempt > retries.limit, and a NonRetryableError ends the instance on attempt 1. Regression since 10.56.0 (#21025): before, the step error was captured on every attempt, so it was reported.

Additional Context

#17421 asked for one error "once all step.do retries have been exhausted, or on a NonRetryableError". #21025 covered only the first case.

Suggested fix: in instrumentedCallback, also capture when error.name === 'NonRetryableError'. I'm happy to open a PR with integration tests.

主要言語
TypeScript
スター
8.8k
フォーク
1.9k
平均マージ
1日 20時間
マージ済み PR(30日)
682

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

getsentry/sentry-javascript のほかの issue

getsentry/sentry-javascript の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。