sukovanej / effect-http

Declarative HTTP API library for effect-ts
https://sukovanej.github.io/effect-http
MIT License
248 stars 20 forks source link

Handle EADDRINUSE #558

Closed Nicholaiii closed 4 months ago

Nicholaiii commented 4 months ago

As is, the library does not handle the case of a port already being in use, instead it just errors (presumably after a timeout) when it realises it's not listening:

timestamp=2024-05-05T16:54:44.745Z level=ERROR fiber=#0 cause="Error [ERR_SERVER_NOT_RUNNING]: Server is not running.

This provides almost no context for the actual error, and it's very hard to debug. I assume this is default platform behaviour, but I think this library is suited to handle this error too.

sukovanej commented 4 months ago

Hey, I noticed such a behaviour as well in the past and it is indeed confusing. This is definitely to be dealt with in the /platform package. Based on the nodejs docs, this error is reported when a close is called upon a not running server. I'll try to investigate in the effect/platform codebase.

sukovanej commented 4 months ago

Hey, Tim released a fix. I just tried it locally and I'm getting beautiful and meaningful listen EADDRINUSE: address already in use :::3000 error message 🎉