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

Đang mở Phù hợp với người mới
#26,091 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
backend-api-design

Hướng nghiên cứu

Bắt đầu bằng cách đọc instrumentWorkflowWithSentry và WrappedWorkflowStep.do, đặc biệt là instrumentedCallback, nơi việc ghi nhận hiện phụ thuộc vào số lần thử. Kiểm tra các bài kiểm thử hiện có cho phần instrumentation workflow của Cloudflare và bổ sung kiểm thử cho một NonRetryableError được ném ra trước lần thử lại cuối cùng. Hoàn thành khi lỗi đó tạo ra một sự kiện Sentry và hành vi khi đã hết số lần thử vẫn được kiểm thử.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
8.8k
Fork
1.9k
Merge trung bình
1 ngày 20 giờ
Pull request đã merge (30 ngày)
682

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của getsentry/sentry-javascript

Tất cả issue của getsentry/sentry-javascript

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.