Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

EADDRINUSE error is uncoded, most of the time #4020

Closed
jeffsmale90 opened this issue Dec 12, 2022 · 1 comment · Fixed by #4045
Closed

EADDRINUSE error is uncoded, most of the time #4020

jeffsmale90 opened this issue Dec 12, 2022 · 1 comment · Fixed by #4045

Comments

@jeffsmale90
Copy link
Contributor

Occupying the port defined by server.port results in an error:

{
  code: undefined,
  message: 'listen EADDRINUSE: address already in use 127.0.0.1:5001'
}

Whereas occupying the port defined by chain.ipfsport (with flavor:filecoin) results in an error:

{
  code: 'EADDRINUSE',
  message: 'listen EADDRINUSE: address already in use 127.0.0.1:5001'
}

Reproduced with Ganache 7.5.0 and @ganache/filecoin 0.1.5

const g = require("ganache");

const handler = (e) => {
  console.error({
    code: e.code,
    message: e.message,
  });
  process.exit(1);
};

const options = {
  flavor: "filecoin",
  server: { port: 8545, host: "127.0.0.1" },
  chain: { ipfsPort: 5001 },
};

g.server(options)
  .listen(options.server.port, options.server.host)
  .catch(handler);
@davidmurdoch
Copy link
Member

Oops! I think this complication comes from the fact that we use uWS and "translate" its error to the form of listen EADDRINUSE: address already in use. This was likely just an oversight.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants