This repository was archived by the owner on Mar 13, 2025. It is now read-only.
Commit fc7eddc
committed
Catch loopback request body abort errors
When `workerd` sends a request to Miniflare's loopback server, we
convert the incoming request to an `undici` `Request` object.
Previously, we passed the incoming request object directly to the
`new Request()` constructor. Internally, `undici` created an async
iterator from this request body stream. Unfortunately, if `workerd`
ever aborted one of these requests (e.g. disposing runtime with a
pending `waitUntil`ed `fetch`), this abort error would be propagated
to the async iterator, and cause an unhandled rejection.
We now convert this incoming request to a `ReadableStream` ourselves,
catching errors from this async iterator, gracefully closing the
stream.1 parent d850639 commit fc7eddc
1 file changed
+38
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
221 | 222 | | |
222 | 223 | | |
223 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
224 | 259 | | |
225 | 260 | | |
226 | 261 | | |
| |||
479 | 514 | | |
480 | 515 | | |
481 | 516 | | |
| 517 | + | |
| 518 | + | |
482 | 519 | | |
483 | 520 | | |
484 | 521 | | |
485 | | - | |
| 522 | + | |
486 | 523 | | |
487 | 524 | | |
488 | 525 | | |
| |||
0 commit comments