test(bun): expect 1009 for oversized WebSocket frames on Bun 1.4+
CI / dco (pull_request) Successful in 5s
CI / runtimes (bun) (pull_request) Successful in 15s
CI / runtimes (deno) (pull_request) Successful in 20s
CI / runtimes (edge) (pull_request) Successful in 14s
CI / build (pull_request) Successful in 27s

CI picked up Bun 1.4.4 (`oven-sh/setup-bun@v2`, latest), which now sends a
real `1009` close frame when `maxPayloadLength` refuses a frame. Bun 1.3
dropped the connection instead, so the peer saw `1006` — the difference D1
documented and these two assertions pinned on purpose so a Bun upgrade would
be noticed. It was: `runtimes (bun)` fails on develop.

The assertion now follows `Bun.version` (1006 before 1.4, 1009 from 1.4), so a
further change in either direction still fails. JSDoc, README and the #107
CHANGELOG entry say which Bun versions do what.

Verified with Bun 1.3.14 and 1.4.4 (26/26 each); lint, format, typecheck,
npm test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
chrnxandClaude Opus 5.5 committed 2026-10-22 23:50:30 -05:00
1 parent 169ffe6b88
commit 69bdc8adec
5 files changed
+15 -13

No files matched your search

+2 -2
View File
@@ -108,8 +108,8 @@ export async function serveBun(app: App, options?: BunServeShortOptions): Promis
},
websocket: {
// The pre-buffer half of `limits.maxWsMessageBytes`: Bun refuses an oversized frame before
// assembling it. It drops the connection without a close frame, so the peer sees 1006 rather
// than 1009 — verified on Bun 1.3, and the price of not buffering the message at all.
// assembling it. Up to Bun 1.3 it dropped the connection without a close frame, so the peer
// saw 1006 rather than 1009 — the price of not buffering the message at all. Bun 1.4 sends 1009.
// `app.upgrade` checks the same bound again on the decoded text.
maxPayloadLength:
(app as { [WS_MAX_MESSAGE_BYTES]?: number })[WS_MAX_MESSAGE_BYTES] ?? DEFAULT_MAX_WS_MESSAGE_BYTES,