Skip to content

Reproduction for sentry-javascript#19883#33

Open
Lms24 wants to merge 2 commits intomainfrom
repro/sentry-javascript-19883
Open

Reproduction for sentry-javascript#19883#33
Lms24 wants to merge 2 commits intomainfrom
repro/sentry-javascript-19883

Conversation

@Lms24
Copy link
Member

@Lms24 Lms24 commented Mar 19, 2026

Reproduction for sentry-javascript#19883

Bug: instrumentWorkflowWithSentry from @sentry/cloudflare swallows the WorkflowStepContext (ctx) parameter in step.do callbacks, making ctx.attempt (and any future context properties) undefined.

Root cause: WrappedWorkflowStep.do in packages/cloudflare/src/workflows.ts:

  1. instrumentedCallback is typed as () => Promise<T> — drops the ctx arg passed by the real step.do
  2. userCallback() is called with zero arguments — doesn't forward ctx

How to run

cd sentry-javascript/19883
node repro.mjs

Output

=== Without Sentry instrumentation ===
  ctx: { attempt: 1 }
  ctx.attempt: 1
  returned: 1

=== With Sentry instrumentation (WrappedWorkflowStep.do) ===
  ctx: undefined
  ctx?.attempt: undefined
  returned: undefined

BUG CONFIRMED: Sentry wrapper swallows ctx — ctx.attempt is undefined.

Made with Cursor

Lms24 added 2 commits March 16, 2026 12:48
Demonstrates that when tracing is disabled (no tracesSampleRate), all
errors from different Express requests share the same traceId instead
of each getting a unique one.

Made-with: Cursor
@Lms24 Lms24 force-pushed the repro/sentry-javascript-19883 branch from e3b4454 to 7386aed Compare March 19, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant