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

server.reload() causes Uncaught AddrInUse: Address already in use (os error 98) when runnign on deno. #29

Open
jhgg opened this issue Feb 6, 2025 · 0 comments · May be fixed by #30
Open
Labels
bug Something isn't working

Comments

@jhgg
Copy link

jhgg commented Feb 6, 2025

What version of Elysia is running?

1.2.12

What platform is your computer?

Linux 5.15.167.4-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

Given the following:

deno.json

{
  "imports": {
    "@elysiajs/node": "npm:@elysiajs/node@^1.2.5",
    "elysia": "npm:elysia@^1.2.12"
  }
}

main.ts

import { Elysia } from "elysia";
import { node } from "@elysiajs/node";

const app = new Elysia({ adapter: node() });

app
  .get("/hello", () => {
    return "Hello, World!";
  })
  .listen(8001);

When running the server, we get the following error:

$ deno run --allow-net --allow-read --allow-env main.ts
error: Uncaught AddrInUse: Address already in use (os error 98)
    at listen (ext:deno_net/01_net.js:504:35)
    at serve (ext:deno_http/00_serve.ts:562:16)
    at ServerImpl._serve (node:http:1452:22)
    at node:http:1397:23
    at Array.processTicksAndRejections (ext:deno_node/_next_tick.ts:28:11)
    at eventLoopTick (ext:core/01_core.js:174:29)

However, the port is not actually in use.

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

This appears to be happening because we are re-creating the server too soon here: https://github.com/elysiajs/node/blob/main/src/index.ts#L411 when the server may have not fully closed.

Have you try removing the node_modules and bun.lockb and try again yet?

N/A

@jhgg jhgg added the bug Something isn't working label Feb 6, 2025
jhgg added a commit to jhgg/node that referenced this issue Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant