Skip to content

fix(cloudflare): wrap Worker entrypoints reached through ctx.exports - #26739

Open
JPeer264 wants to merge 2 commits into
developfrom
fix/cloudflare-ctx-exports-entrypoints
Open

JPeer264 wants to merge 2 commits into
developfrom
fix/cloudflare-ctx-exports-entrypoints

Conversation

@JPeer264

@JPeer264 JPeer264 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

closes #26723
closes JS-4140

Description

This wraps the Worker entrypoints that vinext's Workers Cache adapter adds (VinextCachedResponse, VinextUncachedResponse) with withSentry, so errors thrown while a page renders there are reported. It also adds trace headers to fetch calls through ctx.exports, like fetch calls through env bindings, so the request stage and the response stage are one trace. A new vinext-cf-workers (workers cache) E2E variant builds the app with the real adapter.

Wrapping decisions

Every named re-export appended to virtual:cloudflare/worker-entry is wrapped, and withSentry checks at run time if it extends WorkerEntrypoint. A static check of the adapter file misses the class expressions and factory-made entrypoints that vinext publishes.

Known issues

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: f5e9cf1 (PR test merge using develop at 30efdc0)

Against: 30efdc0 (develop) · base run #67537

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 30.34 kB - -
@sentry/browser - with treeshaking flags 28.53 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.41 kB - -
@sentry/browser (incl. Tracing) 52.98 kB - -
@sentry/browser (incl. Tracing Core) 40.39 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.98 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.84 kB - -
@sentry/browser (incl. Tracing, Replay) 93.02 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.87 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.37 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.96 kB - -
@sentry/browser (incl. Feedback) 48.31 kB - -
@sentry/browser (incl. sendFeedback) 30.91 kB - -
@sentry/browser (incl. FeedbackAsync) 35.96 kB - -
@sentry/browser (incl. Metrics) 31.66 kB - -
@sentry/browser (incl. Logs) 31.94 kB - -
@sentry/browser (incl. Metrics & Logs) 32.6 kB - -
@sentry/react 32.36 kB - -
@sentry/react (incl. Tracing) 55.57 kB - -
@sentry/vue 38.53 kB - -
@sentry/vue (incl. Tracing) 55.92 kB - -
@sentry/svelte 30.36 kB - -
@sentry/effect (client) 42.03 kB - -
@sentry/effect (client, incl. Tracing) 49.17 kB - -
@sentry/effect (client, incl. Tracing, Logs, Metrics) 59.07 kB - -
@sentry/remix (Remix 3 client bundle) 58.61 kB - -
CDN Bundle 32.26 kB - -
CDN Bundle (incl. Tracing) 53.38 kB - -
CDN Bundle (incl. Logs, Metrics) 35.04 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.92 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 76.12 kB - -
CDN Bundle (incl. Tracing, Replay) 91.26 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.89 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.69 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.24 kB - -
CDN Bundle - uncompressed 94.22 kB - -
CDN Bundle (incl. Tracing) - uncompressed 157.81 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 102.56 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 165.44 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 232.79 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 278.09 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 285.72 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 290.02 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 297.64 kB - -
@sentry/nextjs (client) 59.34 kB - -
@sentry/sveltekit (client) 54.26 kB - -
@sentry/core/server 45.81 kB - -
@sentry/core/browser 14.41 kB - -
@sentry/node 156.05 kB +0.01% +1 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.46 kB - -
@sentry/node - without tracing 89.05 kB -0.01% -6 B 🔽
@sentry/node - without channel injection 144.98 kB - -
@sentry/aws-serverless 99.72 kB -0.01% -8 B 🔽
@sentry/cloudflare (withSentry) - minified 209.69 kB +0.11% +230 B 🔺
@sentry/cloudflare (withSentry) 486.95 kB +0.13% +623 B 🔺
@sentry/cloudflare (withSentry, instrumented CommonJS package) - minified 212.63 kB +0.11% +230 B 🔺
@sentry/nextjs/cloudflare (withSentry) - minified 234.92 kB +0.1% +230 B 🔺

View base workflow run

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 1 not successful, 64 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Failing after 1m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E express-5 (bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E express-5 (deno) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-without-tracing-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry (static trace lifecycle) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E deno (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E astro-7 (static trace lifecycle) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 32s Details
✅ CI: Optional E2E Tests / E2E node-flue Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable Test (optional) Successful in 48s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (deno) Test (optional) Successful in 51s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) Successful in 56s Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve (content off) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E express-5 (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Successful in 47s Details
✅ CI: Optional E2E Tests / E2E cloudflare-mastra Test (optional) Successful in 53s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) Successful in 54s Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions Test (optional) Successful in 42s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) Successful in 40s Details
✅ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) Successful in 52s Details
✅ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 47s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 4m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 (MCP SDK OpenTelemetry) Test (optional) Successful in 30s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 38s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-14-supabase Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (bun) Test (optional) Successful in 51s Details
✅ CI: Optional E2E Tests / E2E node-eve (0.x) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-cloudflare Test (optional) Successful in 28s Details
✅ CI: Optional E2E Tests / E2E cloudflare-think Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2-tunnel Test (optional) Successful in 39s Details
✅ CI: Optional E2E Tests / E2E vinext-cf-workers (workers cache) Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel (cloudflare) Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 33s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 40s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (cloudflare) Test (optional) Successful in 32s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 32s Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) Successful in 32s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 49s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-mastra Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) Successful in 43s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 43s Details
✅ CI: Optional E2E Tests / E2E vue-3 (no Options API) Test (optional) Successful in 48s Details

vinext's Workers Cache adapter appends `VinextCachedResponse` and
`VinextUncachedResponse` to the worker-entry module of
`@cloudflare/vite-plugin`. The default export renders pages through
`ctx.exports`, in an invocation that never ran `Sentry.init`, so page
errors were not reported.

The auto-instrument plugin now wraps every named re-export appended to
that module with `withSentry`. `withSentry` checks at run time whether
the value extends `WorkerEntrypoint` and returns any other value
unchanged, which also covers entrypoints that an adapter builds with a
factory. The plugin runs as a `post` plugin, so it sees the appended
exports in any plugin order.

The new `vinext-cf-workers (workers cache)` E2E variant builds the app
with the adapter and checks that a page render error is reported.

Co-Authored-By: Cursor agent <cursoragent@cursor.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JPeer264
JPeer264 force-pushed the fix/cloudflare-ctx-exports-entrypoints branch from e377d4e to 2dc667b Compare November 23, 2026 10:51
@linear-code

linear-code Bot commented Nov 23, 2026

Copy link
Copy Markdown

JS-4140

This branch has not been deployed

No deployments
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.

@sentry/cloudflare/vite: entrypoints reached through ctx.exports are not wrapped (vinext with the Workers Cache adapter sends no error events)

2 participants