0

I get errno: -111 and code: ECONNREFUSED.

When reading the docs there is no error code -111 described in it.

What does this error code mean and where is it documented?

P. S. I'm querying PostgresSQL database through Node.js (using Express.js and node-postgres). Both Node.js backend as well as PostgreSQL database are containerized locally using Docker.

Full error:

Error: connect ECONNREFUSED 127.0.0.1:5432
     at /app/backend/node_modules/pg-pool/index.js:45:11
     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
     at async getAverageSalary (file:///app/backend/src/db/crudFunctions/readCrud.js:10:24)
     at async file:///app/backend/src/routes/getRoute.js:18:19 {
   errno: -111,
   code: 'ECONNREFUSED',
   syscall: 'connect',
   address: '127.0.0.1',
   port: 5432
 }

1 Answer 1

2

The error is documented in your operating system's documentation. It is not documented in PostgreSQL because it is not a PostgreSQL error message.

The meaning of the error is that the remote host refused the connection on that port, usually because there is no service listening there. You either didn't start the PostgreSQL server on that machine, or you configured it to listen somewhere else, or some network component (for example a firewall) is blocking the connection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.