brianc / node-postgres-docs

Documentation for node-postgres
https://node-postgres.com
MIT License
98 stars 94 forks source link

client.connect() returns misleading error #93

Open Herald85 opened 4 years ago

Herald85 commented 4 years ago

I'm working with Docker on W10 and it takes DB a bit longer to start than my app container and I was getting Error: connect ECONNREFUSED... from client.connect(). I wanted to solve it with a timer loop with try to connect every 1 second again, but each other call of client.connect() returned an error Client has already been connected.... And that was not true, DB still hasn't started and any query called on such client ended with an error. What I had to do was to close the client and create a completely new instance on which I could try to call connect again.

My points are:

demattosanthony commented 1 year ago

Still experiencing this issue today.