nitrojs / nitrojs/nitro

NITRO_BUN_IDLE_TIMEOUT=0 is ignored

Open Beginner friendly
#4,189 2 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

Environment
  • nitropack@2.13.1
Reproduction

The bug is very obvious. If you absolutely insist I can make a reproduction, but the problem is immediately clear by looking at the code, it uses || which doesn't account for 0.

Describe the bug

NITRO_BUN_IDLE_TIMEOUT=0 is treated as it's undefined (due to a flaw in implementation) and is effectively ignored. As such, the default timeout of 10 seconds is used.

This is incorrect; 0 is a valid value that disables the timeout entirely. Bun documentation specifically advises to use 0 for streaming & SSE:

Streaming & Server-Sent Events — The idle timer applies while a response is being streamed. If your stream goes quiet for longer than idleTimeout, the connection will be closed mid-response. For long-lived streams, disable the timeout for that request with server.timeout(req, 0).

Additional context

The fix is trivial, I will submit the PR.

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

Search the Nitro source for NITRO_BUN_IDLE_TIMEOUT and inspect the configuration fallback that uses ||. Verify how the Bun server idle timeout is passed through when the environment value is 0. Done means an explicit 0 disables the default 10-second timeout, with the relevant behavior covered by the project's existing checks if available.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, typescript
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.