qwik
qwik copied to clipboard
[🐞] Error on response attempting to close WritableStream with Bun adapter
Which component is affected?
Qwik City (routing)
Describe the bug
When using Qwik with Bun adapter (Bun.serve) with disabled SSG, the server throws an error attempting to close locked WritableStream. From what I can tell, the stream becomes locked after the pipeTo call here and it stays on that stage when writebleStream.close() is called here. The server itself however responds without any issue, this error for some reason just shows up in logs, but I get this during every server response response.
Reproduction
https://github.com/octet-stream/qwik-bun-stream-issue
Steps to reproduce
- Clone this repository;
- Install dependencies via
bun i; - Build the project for production
bun run build; - Start the app via
bun run serve; - Open http://localhost:3000 in your browser;
After the main page shows up, look at the terminal and you'll see following error:
$ bun server/entry.bun.js
Server started: http://localhost:3000/
636 | } finally {
637 | await stream.ready;
638 | await stream.close();
639 | await pipe;
640 | }
641 | await writableStream.close();
^
TypeError: WritableStream.close method can only be used on non locked WritableStream
at writableStreamCloseForBindings (:1:21)
at /Users/octetstream/projects/qwik-bun-stream-issue/server/entry.bun.js:641:11
System Info
System:
OS: macOS 14.3.1
CPU: (10) arm64 Apple M1 Pro
Memory: 62.06 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 21.6.2 - ~/Library/Caches/fnm_multishells/2006_1708258753953/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 10.2.4 - ~/Library/Caches/fnm_multishells/2006_1708258753953/bin/npm
pnpm: 8.15.4 - /opt/homebrew/bin/pnpm
bun: 1.0.29 - /opt/homebrew/bin/bun
Browsers:
Chrome: 122.0.6261.94
Safari: 17.3.1
npmPackages:
@builder.io/qwik: ^1.4.5 => 1.4.5
@builder.io/qwik-city: ^1.4.5 => 1.4.5
undici: * => 6.6.2
vite: ^5.0.12 => 5.1.4
Additional Information
No response