pg_dump to Supabase: "Network is unreachable"
pg_dump: error: connection to server at "db.abcdefghijkl.supabase.co" (2a05:d018:...), port 5432 failed: Network is unreachableThe address in brackets is an IPv6 address. The direct connection host of a Supabase project, db.<project-ref>.supabase.co, resolves to an IPv6 address unless the project has the IPv4 add-on. Your machine or runner has no IPv6 route, so the connection never leaves the network.
GitHub-hosted Actions runners are IPv4-only, which is why scheduled backups there fail with this error while the same command works on some home connections.
Use the Session pooler
In the project dashboard, open Connect and copy the Session pooler string. It looks like this:
postgresql://postgres.<project-ref>:<password>@aws-0-<region>.pooler.supabase.com:5432/postgresPort 5432 on the pooler is session mode, which pg_dump and pg_restore need. Port 6543 is transaction mode, and Supabase advises against it for dumps and migrations.
The IPv4 add-on
On paid plans the IPv4 add-on gives the direct host an IPv4 address instead of an IPv6 one. That also means IPv6-only clients can no longer reach it, so check before switching.
If you use network restrictions
Allow the address your backup runs from. For the direct host that can be an IPv6 range. Through the pooler it is your IPv4 address.
Egress per dump
A dump downloads the whole database each time, and Supabase counts that as egress. Backup egress cost has the numbers, and the GitHub Actions guide a schedule that fits the free allowance.