Repository navigation
Commit 4f9a027
feat(cloudflare): Wrap vinext Worker entries with
part of #19514
part of JS-1803
When a Vite build uses vinext and `@sentry/nextjs/cloudflare` resolves
from the Worker entry, the Vite plugin of `@sentry/cloudflare` now wraps
the entry with `withSentry` from `@sentry/nextjs/cloudflare`. Other
builds, and versions of `@sentry/nextjs` without that entry, keep
`@sentry/cloudflare`.
```diff
-import * as __SENTRY__ from '@sentry/cloudflare';
+import * as __SENTRY__ from '@sentry/nextjs/cloudflare';
const __SENTRY_DEFAULT_EXPORT__ = { fetch() { ... } };
export default __SENTRY__.withSentry(() => undefined, __SENTRY_DEFAULT_EXPORT__);
```
## Why
With `withSentry` of `@sentry/cloudflare`, a vinext app on Workers sends
Cloudflare data but no Next.js spans. Now it gets the Next.js spans
without a config change.
## Traces
The same app and requests: vinext on Workers before and after this PR,
and `next start` on Node.js.
| Request | vinext before | vinext after | Next.js on Node.js |
| --- | --- | --- | --- |
| `GET /parameterized/42` | [`GET`, 1
span](https://sentry-sdks.sentry.io/explore/traces/trace/0f98d8ca6ef645e3ae5bb60c039eeb6d/)
| [`GET /parameterized/[id]`, 7
spans](https://sentry-sdks.sentry.io/explore/traces/trace/a26de83affd24b0c8fe7990e567ae8b6/)
| [`GET /parameterized/[id]`, 7
spans](https://sentry-sdks.sentry.io/explore/traces/trace/c24bdbb12b134e80a5417fe9d2a59c56/)
|
| `GET /api/hello` | [`GET`, 1
span](https://sentry-sdks.sentry.io/explore/traces/trace/df5b9f7976c5487daa7004cc9361eeeb/)
| [`GET /api/hello`, 4
spans](https://sentry-sdks.sentry.io/explore/traces/trace/75b4a831b48f4bb1adb13648f5c6419a/)
| [`GET /api/hello`, 4
spans](https://sentry-sdks.sentry.io/explore/traces/trace/ea8990c798144e2db75ee88e8bd6e634/)
|
| `GET /api/throw` (error) | [`GET`, 1
span](https://sentry-sdks.sentry.io/explore/traces/trace/b6389e0368e44b269e5e07ba9823c29a/)
| [`GET /api/throw`, 3
spans](https://sentry-sdks.sentry.io/explore/traces/trace/07caa661217e4f14bb38b182167d08c7/)
| [`GET /api/throw`, 3
spans](https://sentry-sdks.sentry.io/explore/traces/trace/c9a3a73e3c7a44d4b7ff6519c8760a7b/)
|
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>@sentry/nextjs/cloudflare (#25000)1 parent ba3da33 commit 4f9a027
3 files changed
Lines changed: 121 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
18 | 33 | | |
19 | 34 | | |
20 | 35 | | |
21 | 36 | | |
22 | 37 | | |
23 | 38 | | |
| 39 | + | |
24 | 40 | | |
25 | 41 | | |
26 | 42 | | |
27 | 43 | | |
28 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
29 | 51 | | |
30 | 52 | | |
31 | 53 | | |
| |||
119 | 141 | | |
120 | 142 | | |
121 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
122 | 148 | | |
123 | 149 | | |
124 | 150 | | |
| |||
129 | 155 | | |
130 | 156 | | |
131 | 157 | | |
| 158 | + | |
132 | 159 | | |
133 | 160 | | |
134 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
117 | 119 | | |
118 | 120 | | |
119 | 121 | | |
| |||
198 | 200 | | |
199 | 201 | | |
200 | 202 | | |
201 | | - | |
| 203 | + | |
202 | 204 | | |
203 | 205 | | |
204 | 206 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
58 | 147 | | |
59 | 148 | | |
60 | 149 | | |
| |||
0 commit comments