Commit e07c0c3
fix: use undici.fetch instead of global fetch to match ProxyAgent version
Node.js v22.22.3 ships with built-in undici v6.24.1, which backs the global
fetch(). However, the project depends on undici v8.3.0 (via pnpm). The
ProxyAgent from undici v8.x requires handlers to implement onRequestStart,
but Node.js's built-in fetch handlers (from undici v6.x) do not have this
method. This version mismatch causes every proxied request to immediately
fail with 'invalid onRequestStart method', making the app appear
unresponsive to user input.
Fix: use undici's own fetch() (from the installed v8.x) instead of the
global fetch(), ensuring the fetch implementation version matches the
ProxyAgent version.
- anthropic.ts: pass undiciFetch to Anthropic SDK's fetch option
- openai-compat.ts: replace global fetch() with undiciFetch()
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 2316f16 commit e07c0c3
2 files changed
Lines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
281 | | - | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
282 | 287 | | |
283 | 288 | | |
284 | 289 | | |
| |||
0 commit comments