Skip to content

fix(sveltekit): Read Cloudflare execution context from platform.ctx - #23293

Open
chargome wants to merge 2 commits into
developfrom
fix/sveltekit-cloudflare-execution-context
Open

fix(sveltekit): Read Cloudflare execution context from platform.ctx#23293
chargome wants to merge 2 commits into
developfrom
fix/sveltekit-cloudflare-execution-context

Conversation

@chargome

@chargome chargome commented Aug 11, 2026

Copy link
Copy Markdown
Member

@sveltejs/adapter-cloudflare 8 renamed platform.context to platform.ctx. We now read ctx and fall back to context so adapter <= 7 keeps working.

This fails silently — the execution context is optional-chained everywhere, so a missed lookup drops events instead of throwing.

Refs sveltejs/kit#16668

@chargome chargome self-assigned this Aug 11, 2026
@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
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 30.29 kB - -
@sentry/browser - with treeshaking flags 28.47 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.8 kB - -
@sentry/browser (incl. Tracing) 48.54 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.56 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.44 kB - -
@sentry/browser (incl. Tracing, Replay) 87.95 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.36 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 92.66 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 105.36 kB - -
@sentry/browser (incl. Feedback) 47.61 kB - -
@sentry/browser (incl. sendFeedback) 35.11 kB - -
@sentry/browser (incl. FeedbackAsync) 40.26 kB - -
@sentry/browser (incl. Metrics) 31.28 kB - -
@sentry/browser (incl. Logs) 31.53 kB - -
@sentry/browser (incl. Metrics & Logs) 32.2 kB - -
@sentry/react 32.09 kB - -
@sentry/react (incl. Tracing) 50.73 kB - -
@sentry/vue 35.34 kB - -
@sentry/vue (incl. Tracing) 50.5 kB - -
@sentry/svelte 30.31 kB - -
CDN Bundle 31.59 kB - -
CDN Bundle (incl. Tracing) 48.87 kB - -
CDN Bundle (incl. Logs, Metrics) 33.8 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 50.83 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.34 kB - -
CDN Bundle (incl. Tracing, Replay) 86.46 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 92.17 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.14 kB - -
CDN Bundle - uncompressed 93.77 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.66 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.17 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.46 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.1 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.92 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 271.7 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.61 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.38 kB - -
@sentry/nextjs (client) 53.29 kB - -
@sentry/sveltekit (client) 48.96 kB - -
@sentry/core/server 65.44 kB - -
@sentry/core/browser 51.8 kB - -
@sentry/node 117.98 kB -0.01% -1 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 0 B added added
@sentry/node - without tracing 82.09 kB - -
@sentry/aws-serverless 91.5 kB -0.01% -1 B 🔽
@sentry/cloudflare (withSentry) - minified 214.1 kB - -
@sentry/cloudflare (withSentry) 528.64 kB - -

View base workflow run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bdbb79b. Configure here.

Comment thread packages/sveltekit/src/server-common/utils.ts Outdated
chargome and others added 2 commits August 11, 2026 16:46
`@sveltejs/adapter-cloudflare` 8 renamed `platform.context` to `platform.ctx`. Read `ctx` and
fall back to `context` so adapter <= 7 keeps working.

This fails silently: the execution context is optional-chained everywhere, so a missed
lookup drops events instead of throwing.

Refs sveltejs/kit#16668
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The `any` mirrored core's `MinimalCloudflareContext` but was never necessary here.
Method parameters are bivariant, so the type stays mutually assignable with the real
`ExecutionContext.waitUntil(promise: Promise<any>)` in both directions, and the promise
is only ever passed through rather than inspected.

Drops the lint suppression along with it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chargome
chargome force-pushed the fix/sveltekit-cloudflare-execution-context branch from bdbb79b to e501c3d Compare August 11, 2026 14:46
@chargome
chargome marked this pull request as ready for review August 11, 2026 15:21
@chargome
chargome requested a review from a team as a code owner August 11, 2026 15:21
@chargome
chargome requested review from JPeer264, Lms24, mydea and s1gr1d and removed request for a team and mydea August 11, 2026 15:21
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