Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: provide config idle timeout for bun runtime. #2984

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

jamaluddinrumi
Copy link
Contributor

[Bun.serve]: request timed out after 10 seconds. Pass `idleTimeout` to configure.

we need to be able to configure idle timeout for bun runtime, because if there are any fetch inside event handler sometimes need more than 10 seconds.

we can leverage built in NITRO_SHUTDOWN_TIMEOUT environment variable to configure this.

references:

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

```
[Bun.serve]: request timed out after 10 seconds. Pass `idleTimeout` to configure.
```

we need to be able to configure idle timeout for bun runtime, because if there are any [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch) inside event handler sometimes need more than 10 seconds.

we can leverage built in `NITRO_SHUTDOWN_TIMEOUT ` environment variable to configure this.

references:
- https://bun.sh/docs/api/http#idletimeout
- https://nitro.build/deploy/runtimes/node#environment-variables
@jamaluddinrumi jamaluddinrumi requested a review from pi0 as a code owner January 8, 2025 20:12
@@ -12,6 +12,7 @@ const ws = import.meta._websocket

// @ts-expect-error
const server = Bun.serve({
idleTimeout: process.env.NITRO_SHUTDOWN_TIMEOUT || 10,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not exactly same options, we need bun specific environment variable for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NITRO_BUN_IDLE_TIMEOUT is good for this, isn't it?

btw, luckily, i can use bun patch to overcome this for now. so, no need to rush to fix this as soon as possible in my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants