PostgresSql Database Error : timeout

Hi,
i installed Cube.js with docker in ubuntu 20.04. I created the postgres database with user postgres and changed the password of the user postgres with \password postgres. In pgadmin4 I created the cube-server related to the postgres database of the user postgres and everything works, but when in Cube.js I enter Hostname: cube-server, port 5432, database postgres, username postgres, password of postgres I get:

We couldn’t connect. Please double check the provided data and try again
Runtime Error

Cube.js was unable to connect to the specified database.

The database returned the following error:

Database Error

Error: timeout

Check your database credentials and try again. For more information, visit:
https://cube.dev/docs/config/databases

Why?

Hi, @lovepeacejoy !

Are you running Postgres locally? If so, chances are you just have to specify ‘localhost’ as a hostname instead of ‘cube-server’.

Let me know if that helps

1 Like

Hostname : localhost
Port : 5432
Database : postgres
Username : postgres
Password : obtained with \password postgres

I get the following error:

We couldn’t connect. Please double check the provided data and try again

Runtime Error

Cube.js was unable to connect to the specified database.

The database returned the following error:

Database Error

Error: Error: connect ECONNREFUSED 127.0.0.1:5432

Check your database credentials and try again. For more information, visit:

https://cube.dev/docs/config/databases

@lovepeacejoy
Thanks for sharing.
Check out the first answer for the same error here.

Please, share your DATABASE_URL setting from the docker-compose.yml file if it doesn’t work.