Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

BrowserWorkerRunner: port finalizer throws when the worker global has no close() (Bun)

Open Beginner friendly
#8,635 3 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Effect-TS/effect

All issues in Effect-TS/effect

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.