GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@sentry-junior sentry-junior Bot commented Nov 18, 2026 •
edited by JPeer264
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

(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)

Screenshot 2026-11-20 at 20 02 23

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.

All reactions
@sentry-junior sentry-junior Bot assigned JPeer264 Nov 18, 2026
@sentry-junior
sentry-junior Bot added this pull request to stack #26562 November 18, 2026 11:42
@github-actions

github-actions Bot commented Nov 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Nov 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sentry-junior
sentry-junior Bot force-pushed the jp/cloudflare-no-cjs-core branch 2 times, most recently from 81f2d7c to 61496c1 Compare November 18, 2026 12:08
@sentry-junior sentry-junior Bot mentioned this pull request Nov 18, 2026
chore(size-limit): Measure @sentry/cloudflare with an instrumented CommonJS package #26572
Merged
@sentry-junior
sentry-junior Bot force-pushed the jp/cloudflare-no-cjs-core branch from 61496c1 to 1881de1 Compare November 18, 2026 13:34
JPeer264 added a commit that referenced this pull request Nov 18, 2026
@sentry-junior @JPeer264
chore(size-limit): Measure @sentry/cloudflare with an instrumented Co…
a5c0980
…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]>
@JPeer264
JPeer264 force-pushed the jp/express-e2e-runtime-matrix branch 4 times, most recently from b9a3d2d to c2c8167 Compare November 20, 2026 13:35
Base automatically changed from jp/express-e2e-runtime-matrix to develop November 20, 2026 18:47
@sentry-junior @JPeer264
fix(cloudflare): Do not load a second copy of @sentry/core in Workers
66b795a
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]>
@sentry-junior
sentry-junior Bot force-pushed the jp/cloudflare-no-cjs-core branch from 1881de1 to 66b795a Compare November 20, 2026 18:53
@sentry-junior
sentry-junior Bot removed this pull request from stack #26562 November 20, 2026 18:55
sentry-junior Bot and others added 2 commits November 20, 2026 19:00
@sentry-junior @JPeer264
ref(cloudflare): Share the deferred channel queue between facade and …
1e596a3
…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]>
@sentry-junior @JPeer264
test(cloudflare): Remove the deferred channel events unit test
8884920
Co-Authored-By: Jan Peer Stöcklmair <[email protected]>
@JPeer264
JPeer264 marked this pull request as ready for review November 20, 2026 19:04
@sentry-junior
sentry-junior Bot requested a review from JPeer264 November 20, 2026 19:04
@javascript-sdk-gitflow
javascript-sdk-gitflow Bot requested review from andreiborza, isaacs and logaretm November 20, 2026 19:05
cursor[bot]
cursor Bot reviewed Nov 20, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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.

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 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
All reactions
  • 👀 1 reaction
Comment thread packages/cloudflare/src/orchestrion-deferred-queue.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@sentry-junior
ref(cloudflare): Drop the double cast of globalThis in the deferred q…
7313e2f
…ueue
mydea
mydea approved these changes Nov 23, 2026
View reviewed changes

@mydea mydea left a comment

Copy link
Copy Markdown
Member

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.

damn, crazy finding!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sentry-junior[bot] reacted with eyes emoji
All reactions
  • 👀 1 reaction
@JPeer264
JPeer264 merged commit 059d04c into develop Nov 23, 2026
265 of 268 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@JPeer264
JPeer264 deleted the jp/cloudflare-no-cjs-core branch November 23, 2026 12:06
@sentry-release-bot sentry-release-bot Bot mentioned this pull request Nov 23, 2026
publish: getsentry/[email protected] getsentry/publish#10541
Closed
51 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments
@mydea mydea mydea approved these changes
@JPeer264 JPeer264 Awaiting requested review from JPeer264
@andreiborza andreiborza Awaiting requested review from andreiborza
@isaacs isaacs Awaiting requested review from isaacs
@logaretm logaretm Awaiting requested review from logaretm

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@JPeer264 JPeer264

Labels

None yet

Projects

None yet

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.

2 participants

@mydea @JPeer264
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.