supabase / cli

Supabase CLI. Manage postgres migrations, run Supabase locally, deploy edge functions. Postgres backups. Generating types from your database schema.
https://supabase.com/docs/reference/cli/about
MIT License
1.02k stars 201 forks source link

db dump fails with "Network is unreachable" error message #1944

Closed hypercomputer closed 7 months ago

hypercomputer commented 7 months ago

Describe the bug I have been attempting to use the supabase db dump command to records some changes to my schema that I made within the Supabase web UI, but every time I run it I get the following error message (I altered the IPv6 address in the output):

pg_dump: error: connection to server at "db.MY_PROJECT_REFERENCE_ID.supabase.co" (2600:1f18:2e13:9d02:9512:fb9:1234:abcd), port 5432 failed: Network is unreachable
        Is the server running on that host and accepting TCP/IP connections?

It seems that I am not the only one encountering a similar issues as I found the following recent complaint via the Supabase subreddit.

To Reproduce Steps to reproduce the behavior:

  1. From a terminal run sudo supabase db dump --schema public -f path/to/output.sql
  2. Provide the correct admin and DB password at the prompts
  3. Observe the error message:
    pg_dump: error: connection to server at "db.MY_PROJECT_REFERENCE_ID.supabase.co" (2600:1f18:2e13:9d02:9512:fb9:1234:abcd), port 5432 failed: Network is unreachable
        Is the server running on that host and accepting TCP/IP connections?

Expected behavior The DB schema is written to the specified file.

System information Rerun the failing command with --create-ticket flag (preferred).

sweatybridge commented 7 months ago

Hello, have you tried relinking your project before db dump? CLI fetches the pooler url after linking successfully so that subsequent commands can connect via IPv4.

hypercomputer commented 7 months ago

Ah, thank you! I just tried that and now I am able to use the CLI properly again. Thanks for the help.