Step 2: Run the code with hot reload: bun run --hot src/index.ts. The server runs as expected and websocket connection works properly.
Step 3: Run the code without hot reload: bun run src/index.ts. This is the following error:
6 | entryNamespace = entryNamespace.then((entryNamespace) => {
7 | if(typeof entryNamespace?.default?.fetch === 'function') {
8 | Bun.serve(entryNamespace.default);
9 | }
10 | }, reportError);
11 | Bun.serve(entryNamespace.default);
^
EADDRINUSE: Failed to start server. Is port 3000 in use?
syscall: "listen"
at bun:main:11:13
Bun v1.1.18 (Linux x64)
What is the expected behavior?
There shouldn't be a difference between running an application with and without hot reload.
What do you see instead?
When executing the file with hot reload, Bun.serve tries to open the server on port 3000 but Hono is already using that port (or the other way around, not sure).
Additional information
This is a critical bug fix since I cannot build (and minify) my application to ship for production.
What version of Hono are you using?
4.5.1
What runtime/platform is your app running on?
Bun
What steps can reproduce the bug?
Step 1: Create a simple websocket application
Step 2: Run the code with hot reload:
bun run --hot src/index.ts
. The server runs as expected and websocket connection works properly.Step 3: Run the code without hot reload:
bun run src/index.ts
. This is the following error:What is the expected behavior?
There shouldn't be a difference between running an application with and without hot reload.
What do you see instead?
When executing the file with hot reload,
Bun.serve
tries to open the server on port 3000 but Hono is already using that port (or the other way around, not sure).Additional information
This is a critical bug fix since I cannot build (and minify) my application to ship for production.