App cannot connect to database

I’m currently exploring to migrate from Render → Fly. It’s a Phoenix project (albeit a little older so the default set-up wasn’t 100% compatible out of the box).

I’m hitting a snag now where my app is not able to connect to the database, this is the error message I’m seeing:

14:41:47.339 [error] Postgrex.Protocol (#PID<0.136.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (top2.nearest.of.slick-inbox-db.internal:5432): non-existing domain - :nxdomain

I can also confirm that I can connect to postgres directly with fly postgres -a slick-inbox-db connect, so it looks like the database is up and running. The DATABASE_URL is injected by Fly when I attached it to my app. I’ve also tried recreating the app & database, nothing really worked.

I saw a few other community threads here that suggested to run dig on the app instance - the thing is my app instance is not up, so fly ssh does not work:

$ fly apps list
slick-inbox                     personal        dead            nomad           1h22m ago
slick-inbox-db                  personal        deployed        machines                                       

What other debugging steps can I take here?

This is probably an IPv6 issue. Give this a try: Legacy pre v1.6.3 Phoenix App · Fly Docs