Can't connect to postgres through fly proxy - it keeps hanging

Hi all,
My database has been working fine for more than 4 months. I still regularly check the data through the proxy. My app using rails app.
I just need to use the command RAILS_ENV=production rails c to be able to connect to my data in fly via localhost.
Of course I would run this proxy command first: fly proxy 6543:5432 -a billingsystem-db

fly proxy 6543:5432 -a billingsystem-db
Proxying local port 6543 to remote [billingsystem-db.internal]:5432

However, yesterday, I was unable to connect to the database through this method.
When I run the command RAILS_ENV=production rails c to connect it keeps hanging.
I used pg_admin to connect but it gives me a timeout error.
I say that I entered the correct information of the postgres database.
I have tried removing the postgres app and re-creating it, but it still doesn’t work.
I noticed this issue when upgrading to fly version 2.
Looking forward to all the helpers.

Ignore the “hanging”; open a new window with the same directory name to continue. See my post: Backup and Restore PostgreSQL in, step by step (Backup and Restore PostgreSQL in, step by step)

1 Like

Couple things to try:

Are you able to run fly pg connect -app billingsystem-db ?

Are you able to connect using psql?
E.G. psql postgres://[user]:[password]@localhost:6543/[dbname]

1, when try: fly pg connect -app billingsystem-db
→ Error failed retrieving app pp: Could not find App "pp"
I don’t understand why there is such a weird error message :sweat_smile:
2, when try:

psql postgres://postgres:XXXXXXXX@localhost:6543/billingsyste

→ Doesn’t show anything, it keeps hanging…
3, when I try pg_dump -p 6543 -h localhost -U postgres -c -d postgres -f db_backup
→ It still does not return anything and keeps hanging. It doesn’t prompt you for a password or anything.
4, When run: fly postgres connect -a billingsystem-db
→ connect ok.
Hmmm, I dont know but I noticed the path to connect after initializing the database app is different than before.

The following secret was added to billingsystem:

→ It’s .flycast, not .internal.

This needs two dashes: fly pg connect --app billingsystem-db. That is a funny error.

Rails needs to be using localhost:6543 to connect. Make sure it hasn’t tried to use a different hostname/port.