Error: connect ECONNREFUSED when running migration (pg driver)
See original GitHub issueI am using postgresql
and I get this error when I try to execute a migration:
[ERROR] Error: connect ECONNREFUSED 127.0.0.1:5432
at Object.exports._errnoException (util.js:1022:11)
at exports._exceptionWithHostPort (util.js:1045:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1087:14)
In my database.json
I have this configuration:
{
"dev": {
"driver": "pg"
},
"pg": {
"driver": "pg",
"user": "test",
"password": "test",
"host": "postgres://localhost:5433",
"database": "testdb",
"schema": "public"
}
}
I can execute sql
code inside my app but I can’t using migrations
Probably the problem comes because the port I am using is different from which uses the package? I think it is a bit strange because I tried with Docker where I have the port 5432
and I get the same errors.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
connect ECONNREFUSED 127.0.0.1:5432 docker migrate ...
A solution for this problem is using a script that only launches the server a few seconds after the db has started. In...
Read more >Error: connect ECONNREFUSED 127.0.0.1:5432
Caused by: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the ...
Read more >error: connect econnrefused 127.0.0.1:5432 at ... - You.com
I set up the pg Pool correctly, and it works just fine if I want to connect it to my AWS postgres server...
Read more >FATAL: Ident authentication failed for user - Unable to connect ...
Password authentication failed with PostgreSQL 9 · Bitbucket fails to connect to PostgreSQL Server with a "Connection refused" error · Database migration to ......
Read more >Connect from Cloud Run | Cloud SQL for PostgreSQL
Note: Some drivers require the `unix_sock` query parameter to use a different key. # For example, 'psycopg2' uses the path set to `host`...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@wzrdtales I have solved the problem. As you said it was about the IP, as I am using
docker-compose
I did not specify theenvironment
on myweb
service and I was trying to connect two containers withlocalhost
.Try this.
“pg”: { “driver”: “pg”, “user”: “test”, “host”: “localhost”, “port”: 5433, “database”: “testdb”, “schema”: “public” }