Skip to content

Commit 2cc8197

Browse files
fix: start transferred MessagePort in fetch-sync worker (#9198)
* fix: start transferred MessagePort in fetch-sync worker This was causing running Miniflare in Bun tests to hang indefinitely. * add changeset --------- Co-authored-by: Peter Bacon Darwin <[email protected]>
1 parent da7a0a6 commit 2cc8197

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.changeset/stupid-files-jog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"miniflare": patch
3+
---
4+
5+
fix: ensure the fetch proxy message port is started
6+
7+
While Node.js will start the message port automatically when a `message` event listener is added,
8+
this diverges from the standard Web API for message ports, which require you to explicitly start
9+
listening on the port.

packages/miniflare/src/plugins/core/proxy/fetch-sync.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ port.addEventListener("message", async (event) => {
8282
Atomics.store(notifyHandle, /* index */ 0, /* value */ 1);
8383
Atomics.notify(notifyHandle, /* index */ 0);
8484
});
85+
86+
port.start();
8587
`;
8688

8789
// Ideally we would just have a single, shared `unref()`ed `Worker`, and an

0 commit comments

Comments
 (0)