Skip to content

fix(cloudflare): Forward ctx argument to Workflow.do user callback#19891

Merged
Lms24 merged 1 commit intodevelopfrom
lms/fix-cloudflare-workflow-ctx
Mar 20, 2026
Merged

fix(cloudflare): Forward ctx argument to Workflow.do user callback#19891
Lms24 merged 1 commit intodevelopfrom
lms/fix-cloudflare-workflow-ctx

Conversation

@Lms24
Copy link
Member

@Lms24 Lms24 commented Mar 19, 2026

This PR fixes a bug in our Cloudflare Workflows instrumentation where we didn't forward the recently introduced ctx argument to users' Workflow.do callbacks. We now pass all ...args from the workflow through our instrumentation to the user callback.

closes #19883

@github-actions
Copy link
Contributor

github-actions bot commented Mar 19, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (deps) Bump stacktrace-parser from 0.1.10 to 0.1.11 by dependabot in #19887

Bug Fixes 🐛

  • (cloudflare) Forward ctx argument to Workflow.do user callback by Lms24 in #19891
  • (deps) Bump socket.io-parser to 4.2.6 to fix CVE-2026-33151 by chargome in #19880
  • (nestjs) Add node to nest metadata by chargome in #19875
  • (serverless) Add node to metadata by nicohrubec in #19878

Internal Changes 🔧

  • (astro) Re-enable server island tracing e2e test in Astro 6 by Lms24 in #19872

🤖 This preview updates automatically when you update the PR.

Copy link
Member

@JPeer264 JPeer264 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. A reminder to ourselves that this could happen anytime. It might make sense to always just forward all callback arguments in Cloudflare when there is something like that to be future proof.

@github-actions
Copy link
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 25.52 kB -0.44% -112 B 🔽
@sentry/browser - with treeshaking flags 24.04 kB -0.43% -102 B 🔽
@sentry/browser (incl. Tracing) 42.5 kB -0.27% -115 B 🔽
@sentry/browser (incl. Tracing, Profiling) 47.17 kB -0.23% -105 B 🔽
@sentry/browser (incl. Tracing, Replay) 81.31 kB -0.14% -109 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 70.88 kB -0.17% -116 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 86.01 kB -0.13% -110 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 98.27 kB -0.11% -104 B 🔽
@sentry/browser (incl. Feedback) 42.35 kB -0.24% -99 B 🔽
@sentry/browser (incl. sendFeedback) 30.2 kB -0.37% -110 B 🔽
@sentry/browser (incl. FeedbackAsync) 35.25 kB -0.32% -110 B 🔽
@sentry/browser (incl. Metrics) 26.81 kB -0.43% -115 B 🔽
@sentry/browser (incl. Logs) 26.95 kB -0.43% -116 B 🔽
@sentry/browser (incl. Metrics & Logs) 27.64 kB -0.38% -103 B 🔽
@sentry/react 27.3 kB -0.34% -93 B 🔽
@sentry/react (incl. Tracing) 44.86 kB -0.21% -91 B 🔽
@sentry/vue 29.99 kB -0.32% -94 B 🔽
@sentry/vue (incl. Tracing) 44.38 kB -0.25% -107 B 🔽
@sentry/svelte 25.55 kB -0.45% -115 B 🔽
CDN Bundle 28.2 kB -0.27% -74 B 🔽
CDN Bundle (incl. Tracing) 43.39 kB -0.27% -117 B 🔽
CDN Bundle (incl. Logs, Metrics) 29.07 kB -0.26% -75 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) 44.26 kB -0.23% -99 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) 68.12 kB -0.14% -90 B 🔽
CDN Bundle (incl. Tracing, Replay) 80.23 kB -0.13% -101 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 81.14 kB -0.12% -91 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 85.78 kB -0.11% -91 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.67 kB -0.12% -101 B 🔽
CDN Bundle - uncompressed 82.32 kB -0.37% -304 B 🔽
CDN Bundle (incl. Tracing) - uncompressed 128.25 kB -0.25% -315 B 🔽
CDN Bundle (incl. Logs, Metrics) - uncompressed 85.19 kB -0.36% -304 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 131.11 kB -0.24% -315 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 208.82 kB -0.15% -304 B 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed 245.1 kB -0.13% -315 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 247.95 kB -0.13% -315 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 258.01 kB -0.13% -315 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 260.85 kB -0.13% -315 B 🔽
@sentry/nextjs (client) 47.28 kB -0.19% -86 B 🔽
@sentry/sveltekit (client) 42.95 kB -0.28% -119 B 🔽
@sentry/node-core 56.28 kB -0.12% -62 B 🔽
@sentry/node 173.21 kB +0.04% +52 B 🔺
@sentry/node - without tracing 96.27 kB -0.08% -77 B 🔽
@sentry/aws-serverless 113.28 kB -0.06% -61 B 🔽

View base workflow run

@Lms24
Copy link
Member Author

Lms24 commented Mar 19, 2026

It might make sense to always just forward all callback arguments in Cloudflare when there is something like that to be future proof

Agreed! I had Cursor go over the cloudflare SDK and look for similar occurances but we usually pass all args. Worth noting that we use Reflect and Proxy in most other instrumentation. We could look into aligning workflows here though I'm not sure if there's a specific reason we're breaking pattern here.

Based on the analysis, this was the only occurance where we didn't pass in arguments. We can follow up with a better audit but for now I think we're good.

@Lms24 Lms24 merged commit ddca82a into develop Mar 20, 2026
114 of 116 checks passed
@Lms24 Lms24 deleted the lms/fix-cloudflare-workflow-ctx branch March 20, 2026 10:10
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.

instrumentWorkflowWithSentry swallows WorkflowStepContext (ctx.attempt) in step.do callbacks

2 participants