GeezerVison is showing github.com — fix(cloudflare): Do not load a second copy of @sentry/core in Workers by sentry-junior[bot] · Pull Request #26568 · getsentry/sentry-javascript
Conversation
sentry-junior
Bot
commented
Nov 18, 2026
•
edited by JPeer264
Loading
Uh oh!
There was an error while loading. Please reload this page.
(This is Jan speaking: This is only moving code around to drop bundle size. It seems we're saving 80% of bundle size when we move some functions around)
What
A Cloudflare Worker that bundles a CommonJS package that the SDK instruments, such as express or mysql, no longer gets a second copy of @sentry/core.
Size of the express-5 Worker (vite build, not minified):
|
index.mjs |
gzip |
sources from @sentry/core/build/cjs |
| before |
4,862,923 B |
1,153,004 B |
3 |
| after |
3,579,334 B |
902,226 B |
0 |
The CommonJS build of @sentry/conventions also leaves the bundle, because only the CommonJS build of @sentry/core pulled it in.
Why
Transformed CommonJS packages require the diagnostics_channel facade, so the bundler takes the CommonJS build of the facade. The facade imported ./orchestrion-deferred-channels, and that module imports @sentry/core. Now the facade defers events itself and reads the queue from globalThis, with only a type import of @sentry/core. The flush does not change.
#26572 adds a size-limit entry against develop for this case (1.01 MB minified today, about 210 kB with this change). Once it lands and this stack is rebased, the size report of this PR shows the drop.
via @JPeer264.
--
View Session [Sentry]
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
size-limit report 📦
Compared: e76b34c (PR test merge using develop at ef89ae2)
Against: ef89ae2 (develop) · base run #67338
✅ Baseline matches: this diff contains only this PR's changes.
| Path |
Size |
% Change |
Change |
| @sentry/browser |
30.23 kB |
- |
- |
| @sentry/browser - with treeshaking flags |
28.43 kB |
- |
- |
| @sentry/browser - with treeshaking flags tracing without tracing |
28.33 kB |
- |
- |
| @sentry/browser (incl. Tracing) |
52.81 kB |
- |
- |
| @sentry/browser (incl. Tracing Core) |
40.33 kB |
- |
- |
| @sentry/browser (incl. Tracing + Span Streaming) |
52.81 kB |
- |
- |
| @sentry/browser (incl. Tracing, Profiling) |
55.69 kB |
- |
- |
| @sentry/browser (incl. Tracing, Replay) |
92.88 kB |
- |
- |
| @sentry/browser (incl. Tracing, Replay) - with treeshaking flags |
81.7 kB |
- |
- |
| @sentry/browser (incl. Tracing, Replay with Canvas) |
97.22 kB |
- |
- |
| @sentry/browser (incl. Tracing, Replay, Feedback) |
110.8 kB |
- |
- |
| @sentry/browser (incl. Feedback) |
48.17 kB |
- |
- |
| @sentry/browser (incl. sendFeedback) |
30.81 kB |
- |
- |
| @sentry/browser (incl. FeedbackAsync) |
35.84 kB |
- |
- |
| @sentry/browser (incl. Metrics) |
31.55 kB |
- |
- |
| @sentry/browser (incl. Logs) |
31.83 kB |
- |
- |
| @sentry/browser (incl. Metrics & Logs) |
32.49 kB |
- |
- |
| @sentry/react |
32.24 kB |
- |
- |
| @sentry/react (incl. Tracing) |
55.45 kB |
- |
- |
| @sentry/vue |
38.45 kB |
- |
- |
| @sentry/vue (incl. Tracing) |
55.75 kB |
- |
- |
| @sentry/svelte |
30.24 kB |
- |
- |
| @sentry/remix (Remix 3 client bundle) |
58.46 kB |
- |
- |
| CDN Bundle |
32.16 kB |
- |
- |
| CDN Bundle (incl. Tracing) |
53.19 kB |
- |
- |
| CDN Bundle (incl. Logs, Metrics) |
34.95 kB |
- |
- |
| CDN Bundle (incl. Tracing, Logs, Metrics) |
55.76 kB |
- |
- |
| CDN Bundle (incl. Replay, Logs, Metrics) |
76.02 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay) |
91.1 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Logs, Metrics) |
93.71 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Feedback) |
96.51 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) |
99.07 kB |
- |
- |
| CDN Bundle - uncompressed |
93.91 kB |
- |
- |
| CDN Bundle (incl. Tracing) - uncompressed |
157.26 kB |
- |
- |
| CDN Bundle (incl. Logs, Metrics) - uncompressed |
102.24 kB |
- |
- |
| CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed |
164.88 kB |
- |
- |
| CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed |
232.48 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay) - uncompressed |
277.53 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed |
285.16 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed |
289.46 kB |
- |
- |
| CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed |
297.08 kB |
- |
- |
| @sentry/nextjs (client) |
59.15 kB |
- |
- |
| @sentry/sveltekit (client) |
54.06 kB |
- |
- |
| @sentry/core/server |
45.28 kB |
- |
- |
| @sentry/core/browser |
14.41 kB |
- |
- |
| @sentry/node |
154.01 kB |
-0.01% |
-7 B 🔽 |
| @sentry/node/import (ESM hook with diagnostics-channel injection) |
83.33 kB |
- |
- |
| @sentry/node - without tracing |
88.81 kB |
- |
- |
| @sentry/node - without channel injection |
142.98 kB |
-0.01% |
-6 B 🔽 |
| @sentry/aws-serverless |
99.41 kB |
-0.01% |
-3 B 🔽 |
| @sentry/cloudflare (withSentry) - minified |
208.52 kB |
+0.01% |
+19 B 🔺 |
| @sentry/cloudflare (withSentry) |
483.96 kB |
+0.02% |
+84 B 🔺 |
| @sentry/cloudflare (withSentry, instrumented CommonJS package) - minified |
211.47 kB |
-79.27% |
-808.31 kB 🔽 |
| @sentry/nextjs/cloudflare (withSentry) - minified |
233.76 kB |
+0.01% |
+19 B 🔺 |
View base workflow run
|
sentry-junior[bot] reacted with eyes emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Optional E2E tests
Some optional checks were not successful. They do not block the merge. 3 not successful, 34 successful. See the run.
|
Check |
Status |
|
| ❌ |
CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) |
Failing after 40s |
Details |
| ❌ |
CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) |
Failing after 3m |
Details |
| ❌ |
CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) |
Failing after 1m |
Details |
Successful checks
|
Check |
Status |
|
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-mastra Test (optional) |
Successful in 49s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E express-5 (bun) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-think Test (optional) |
Successful in 57s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) |
Successful in 52s |
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 express-5 (cloudflare) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nestjs-12 (deno) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) |
Successful in 45s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nestjs-12 (bun) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nestjs-12 (cloudflare) Test (optional) |
Successful in 37s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E express-5 (deno) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-14-supabase Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) |
Successful in 59s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) |
Successful in 3m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5 Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) |
Successful in 39s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) |
Successful in 54s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-workers-without-tracing-send-to-sentry Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) |
Successful in 44s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-pi-durable Test (optional) |
Successful in 46s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) |
Successful in 35s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5-tunnel (cloudflare) Test (optional) |
Successful in 29s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5-cloudflare Test (optional) |
Successful in 30s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) |
Successful in 46s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) |
Successful in 36s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) |
Successful in 43s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) |
Successful in 50s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E astro-7 (static trace lifecycle) Test (optional) |
Successful in 1m |
Details |
|
sentry-junior[bot] reacted with eyes emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
JPeer264
added a commit
that referenced
this pull request
Nov 18, 2026
…mmonJS package (#26572)
## What
Adds the size-limit entry `@sentry/cloudflare (withSentry, instrumented
CommonJS package) - minified`. It bundles the CommonJS build of the
orchestrion `diagnostics_channel` facade next to the ES module entry of
`@sentry/cloudflare`.
## Why
The existing `@sentry/cloudflare` entries only bundle the ES module
entry, and the facade is not reachable from it. In a Worker,
`sentryCloudflareVitePlugin` makes each instrumented CommonJS package
(`express`, `mysql`) `require` the facade, so the Worker gets its
CommonJS build and everything that build loads. The size check never
measured this. Today, that includes a complete second copy of
`@sentry/core`.
#26568 removes that copy.
<!-- junior-request-attribution:start -->
via @JPeer264.
<!-- junior-request-attribution:end -->
<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0CA6TD3QRK%3A1794999223.925669 -->
--
[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0CA6TD3QRK%3A1794999223.925669)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0CA6TD3QRK%3A1794999223.925669/?project=4510944073809921)
<!-- junior-session-footer:end -->
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Jan Peer Stöcklmair <[email protected]>
Transformed CommonJS packages (`express`, `mysql`) `require` the
orchestrion `diagnostics_channel` facade, so the bundler takes its
CommonJS build. The facade imported `./orchestrion-deferred-channels`,
which imports `debug` and `GLOBAL_OBJ` from `@sentry/core`. The Worker
bundle so got the complete CommonJS build of `@sentry/core` (and of
`@sentry/conventions`) next to the ES module build that the SDK uses.
The facade now defers channel events itself and reads the queue from
`globalThis`, with only a type import of `@sentry/core`. The flush stays
in `orchestrion-deferred-channels` and reads the same queue.
Co-Authored-By: Jan Peer Stöcklmair <[email protected]>
…flush
The facade and the flush each declared `DeferredChannelEvent` and
`getDeferredEvents`. They now import both from
`orchestrion-deferred-queue`, which has no runtime imports, so the facade
still loads no `@sentry/core` and the request wrapper still loads no
`node:` builtin.
Co-Authored-By: Jan Peer Stöcklmair <[email protected]>
There was a problem hiding this comment.
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.

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8884920. Configure here.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
sentry-junior[bot] reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
sentry-junior[bot] reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|