Nitro with bun
preset can't connect to WebSocket during development
#2721
Labels
bun
preset can't connect to WebSocket during development
#2721
Environment
Reproduction
https://github.com/Anoesj/nitro-bun-websocket-issue
Note
I could not create a reproduction in Stackblitz/CodeSandbox, as I couldn't figure out how to use Bun there. Therefore, I created a repo instead. Make sure to read the README for reproduction steps.
Describe the bug
I'm trying to get WebSockets to work in a Nuxt application. I've turned on
nitro.experimental.websocket
innuxt.config.ts
and I'm using thebun
Nitro preset.During development (
bun --bun run dev
), the WebSocket'sonopen
event never fires, suggesting the connection can't be fully established, but doesn't "fail" either.After building the app and previewing it (
bun --bun run build && bun --bun run preview
), the WebSocket does work.When using the
node-server
Nitro preset instead, the WebSocket does not work in both development mode and after building and previewing the app.When switching to
node
by omitting the--bun
flag (so:bun run dev
/bun run build && bun run preview
), the WebSocket does work in both development mode and after building and preview the app, for both Nitro presetbun
andnode-server
.So all in all:
bun
bun
node-server
node-server
bun
bun
node-server
node-server
Additional context
Bun revision:
1.1.27+267afa293
Platform:
Linux 6.8.0-40-generic x86_64 x86_64
.If this is a Nuxt issue, feel free to transfer the issue to the Nuxt repository.
Logs
No response
The text was updated successfully, but these errors were encountered: