Connection timeout when trying to connect to Postgres cluster from outside fly

I’m having issues running flyctl proxy and flyctl postgres connect to connect to my Postgres cluster, and with running fly pg attach to set up a database for a new app in the cluster.

For the proxy command I’m running flyctl proxy 5433:5432 -a my-cluster-name The command looks like it works in the terminal, but then when I try to connect in my Postgres client I get the error message “Connection terminated due to connection timeout”. The other commands just hang for a long time. fly postgres connect eventually gives me this: Error error connecting to SSH server: connect tcp [fdaa:0:7298:a7b:2c60:1:32a6:2]:22: operation timed out

I’ve tried running fly wireguard reset several times and that doesn’t seem to have worked. I have an existing app in fly with a database in the cluster that’s working fine when I access it on the web.

In case it’s helpful, here’s the output of flyctl doctor. I am able to run flyctl ssh to connect to my other app - this seems specific to the postgres cluster.

$ flyctl doctor
Testing authentication token... PASSED
Testing flyctl agent... PASSED
Testing local Docker instance... PASSED
Pinging WireGuard gateway (give us a sec)... PASSED

Try running fly ips private and check the IP against the error. It’s possible the connect/ssh command is using a stale IP address.

I tried again today and I’m no longer having any issues connecting. After I posted yesterday I tried deleting the Postgres cluster and creating a new one with a different name, and that was also having the same problem, but it all seems to be working fine now. I’ll give fly ips private a try if I have problems in the future, thanks!

This issue has cropped up again for me today, and when I run fly ips private I see the same ip address as in the error message when I try to run flyctl postgres connect, so it doesn’t look like it is a stale IP address.

1 Like

I have the same problem