Commit 6396adc
fix(server-utils): Keep node:async_hooks out of the edge/browser barrels
The Hydrogen (Oxygen) e2e app `remix-hydrogen` failed to build: its client bundle
pulled `@sentry/server-utils/async-context` (`import { AsyncLocalStorage } from
'node:async_hooks'`), which Vite externalizes into an empty stub, throwing
`"AsyncLocalStorage" is not exported by "__vite-browser-external"`.
`async-context` is the only module in the shared `exports.ts` surface that
statically imports a `node:` builtin, yet it was re-exported from both the `index`
and `no-diagnostic-channels` barrels — so any browser/edge bundle importing *any*
helper from those barrels dragged `node:async_hooks` into the graph.
- Move `setAsyncLocalStorageAsyncContextStrategy` out of the shared `exports.ts`
into a dedicated `@sentry/server-utils/async-context` entry, so `index` /
`no-diagnostic-channels` are free of `node:` builtins. Update its consumers
(Node/Deno/Cloudflare SDKs + tests), all of which run where `node:async_hooks`
resolves.
- Point the two `@sentry/remix/cloudflare`-reachable imports (`instrumentServer`'s
`loadModule`, `cloudflare/index`'s `trpcMiddleware`) at the lean
`no-diagnostic-channels` barrel instead of the full `@sentry/server-utils`
barrel, whose Node-only integrations (`tedious` → `node:events`, …) otherwise
reach the bundled Hydrogen client build.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D7JDQBD9J2okCe1hkWCanU1 parent eb54f84 commit 6396adc
24 files changed
Lines changed: 43 additions & 22 deletions
File tree
- packages
- cloudflare
- src
- instrumentations
- test
- instrumentations
- utils
- deno/src
- node
- src/sdk
- test/sdk
- remix/src
- cloudflare
- server
- server-utils
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
| 179 | + | |
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
0 commit comments