Repository navigation
Commit 5d3ee29
fix(cloudflare): Keep request scopes for streamed responses and the body opt-out
Two Cloudflare integration tests failed after the move to the shared
request handler wrapper.
Without `nodejs_compat`, Cloudflare has no `AsyncLocalStorage`. The
wrapper ends the span of a streamed response from a stream callback,
after the handler returns, and that callback ran outside the request's
scopes. There `getClient()` found no client, so core sent the segment
span as a static transaction instead of streaming it, and a captured
stream error would not update the request session. The wrapper now runs
these callbacks in the request's isolation scope and current scope.
Before the move, removing `httpServerIntegration` turned off request
body capture on Cloudflare. The wrapper used `dataCollection.httpBodies`
instead, so bodies were attached. Cloudflare now passes
`maxRequestBodySize: 'none'` when the integration is missing, and the
CHANGELOG no longer lists that change.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>1 parent 6a844a0 commit 5d3ee29
3 files changed
Lines changed: 37 additions & 7 deletions
File tree
- packages
- cloudflare/src
- server-utils/src/utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
126 | 125 | | |
127 | 126 | | |
128 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
104 | 108 | | |
105 | 109 | | |
106 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
159 | 162 | | |
160 | 163 | | |
161 | 164 | | |
162 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
163 | 172 | | |
164 | 173 | | |
165 | 174 | | |
| |||
235 | 244 | | |
236 | 245 | | |
237 | 246 | | |
| 247 | + | |
238 | 248 | | |
239 | 249 | | |
240 | 250 | | |
241 | | - | |
| 251 | + | |
242 | 252 | | |
243 | 253 | | |
244 | 254 | | |
| |||
248 | 258 | | |
249 | 259 | | |
250 | 260 | | |
251 | | - | |
252 | | - | |
| 261 | + | |
| 262 | + | |
253 | 263 | | |
254 | 264 | | |
255 | | - | |
| 265 | + | |
256 | 266 | | |
257 | 267 | | |
258 | 268 | | |
259 | 269 | | |
260 | 270 | | |
261 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
262 | 289 | | |
263 | 290 | | |
264 | 291 | | |
| |||
0 commit comments