BrowserWorkerRunner: port finalizer throws when the worker global has no close() (Bun)
Maintainers usually reply within 1 day
@santiago-ramos-02 is already working on this.
Since Sep 30, 2026.
- #8636 by @santiago-ramos-02 — open
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- bun, typescript
- Domain
- web-dev
Research direction
Start at BrowserWorkerRunner.make and inspect the port finalizer, especially how it handles the worker global used as a port. Run the relevant Bun worker tests or a bun test suite that exercises browser worker code, and confirm shutdown no longer throws when the worker global lacks close().
Written by the indexing model from the issue text.
Description
BrowserWorkerRunner.make registers a finalizer for each port that calls port.close() unconditionally:
Effect.sync(() => {
port.removeEventListener("message", onMsg)
port.removeEventListener("messageerror", onMessageError)
port.close()
})
In a dedicated worker, layer passes the worker global as the port. Bun's worker global implements postMessage and addEventListener/removeEventListener, but has no close() (Bun 1.4.2):
// worker.ts, run with `new Worker(new URL("./worker.ts", import.meta.url))` under Bun
postMessage({ hasClose: "close" in self, type: typeof (self as any).close })
// => { hasClose: false, type: "undefined" }
So when the runner shuts down in a Bun worker (for example in a bun test suite that exercises browser worker code), the finalizer throws TypeError: port.close is not a function.
The owning parent terminates the worker anyway, so skipping close() when it is missing is safe. #6680 already fixed the messageerror listener removal in the same finalizer; this is the remaining part.
Environment: @effect/[email protected], Bun 1.4.2, Windows x64. Still present on main.
- Dominant language
- TypeScript
- Stars
- 16.7k
- Forks
- 808
- Avg merge
- 10h 14m
- Merged PRs (30d)
- 518
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Effect-TS/effect
-
Support {self: this} for fnUntracedMay be free again @ArjunCodess claimed this 23 days ago, and no pull request is open. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Effect-TS/effect#8101 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Schema.isPowerOfPossibly taken @effect-bot claimed this 1 day ago. Openenhancement
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
add Effect-native McpClientPossibly taken @lloydrichards claimed this 5 days ago. Openenhancement
Difficulty 5/5 Over a week Newbie friendliness 8/100
Effect-TS/effect#8912 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
All issues in Effect-TS/effect
Similar issues
-
Bayern feature:Application ready web
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
digitalfabrik/entitlementcard#3176 ·
Maintainers usually reply within 7 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
NanmiCoder/cc-haha#1533 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
🐛 Bug: Calendar work items cannot be opened on mobilePossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 1/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100