nitrojs / nitrojs/nitro

WebSocketError: Connection refused in bun `--bun` runtime

Open
#3,171 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug v2
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

[UPDATED]

Environment

  • Operating System: Darwin
  • Node Version: v22.14.0
  • Nuxt Version: -
  • CLI Version: 3.22.5
  • Nitro Version: 2.11.1
  • Package Manager: pnpm@10.5.2
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

bun 1.2.4

Reproduction

https://github.com/jamaluddinrumi/can-not-send-anything-websocket

or

just start with starter template

follow websocket usage

run

bun --bun run dev

and type in the terminal, i use websocat tool to checking the websocket logs

websocat ws://localhost:3000 -v

it returns

[INFO  websocat::lints] Auto-inserting the line mode
[INFO  websocat::stdio_threaded_peer] get_stdio_peer (threaded)
[INFO  websocat::ws_client_peer] get_ws_client_peer
[INFO  websocat::net_peer] Failure during connecting TCP: Connection refused (os error 61)
websocat: WebSocketError: Connection refused (os error 61)
websocat: error running

without received sent message Welcome ${peer}!

Describe the bug

it should sent Welcome ${peer}! message

Additional context

No response

Logs

Contributor guide

Open the contributing guide

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.

Research direction

Start by reproducing the issue with the starter template and the WebSocket usage guide using bun --bun run dev, then connect with websocat ws://localhost:3000 -v. Trace why the Bun runtime refuses the connection; done means the development server accepts the WebSocket connection and sends the expected Welcome ${peer}! message.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, typescript
Domain
backend, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.