Bun's `fetch` crashes local Worker

Whenever a request is made using bun's fetch, it crashes my local Cloudflare worker (Miniflare). I came across this open issue on Bun's github repo, which seems related, but based on the behavior, it feels more like a problem on miniflare side rather than Bun itself. Client output:
error: The socket connection was closed unexpectedly. For more information, p
ass `verbose: true` in the second argument to fetch()
error: The socket connection was closed unexpectedly. For more information, p
ass `verbose: true` in the second argument to fetch()
Wrangler logs:
--- 2025-06-25T01:14:17.368Z debug
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE {
id: 100000002,
result: { debuggerId: '2750999333788739009.2909329677613737887' }
}
---

--- 2025-06-25T01:14:17.368Z debug
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000003, method: 'Network.enable', result: {} }
---

--- 2025-06-25T01:14:17.911Z debug
*** Fatal uncaught kj::Exception: kj/async-io-unix.c++:1365: failed: setsocketopt(IPPROTO_TCP, TCP_NODELAY): Invalid argument
stack: 104e98a23 104e98ce7 104e6798b 104e8ce68 102d2d7ff 102d2e3fb 102d31933 102d320d3 102d3299f 102cd9853 104eb9b1f 104eb9e27 104eb886f 104eb85db 102cc8803
190824273
---
--- 2025-06-25T01:14:17.368Z debug
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE {
id: 100000002,
result: { debuggerId: '2750999333788739009.2909329677613737887' }
}
---

--- 2025-06-25T01:14:17.368Z debug
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000003, method: 'Network.enable', result: {} }
---

--- 2025-06-25T01:14:17.911Z debug
*** Fatal uncaught kj::Exception: kj/async-io-unix.c++:1365: failed: setsocketopt(IPPROTO_TCP, TCP_NODELAY): Invalid argument
stack: 104e98a23 104e98ce7 104e6798b 104e8ce68 102d2d7ff 102d2e3fb 102d31933 102d320d3 102d3299f 102cd9853 104eb9b1f 104eb9e27 104eb886f 104eb85db 102cc8803
190824273
---
GitHub
bun fetch to wrangler dev server crashes server and fails with "soc...
What version of Bun is running? Confirmed as broken in 1.1.20, 1.1.13 and working in 1.1.11 What platform is your computer? macOS What steps can reproduce the bug? package.json { "name": ...
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?