cli: failed to connect to postgres: failed to connect to `host=db.[id].supabase.co user=postgres database=postgres`: dial error (dial tcp [2406:da14:271:9903:c1bf:5f4c:ff8a:9e0c]:5432: connect: no route to host)

Describe the bug I have been using Supabase Cli to push migration to remote db with zero issues, until all the sudden I was not able to do that. I can still link to different projects within the same account but now commands such as supabase db push --link supabase migrations list throw an error as seen in title.

Supabase CLI 2.19.7
Connecting to remote database...
2025/03/18 21:28:29 Connect Start: tcp [2406:da14:271:9903:c1bf:5f4c:ff8a:9e0c]:5432
2025/03/18 21:28:29 Connect Error: tcp [2406:da14:271:9903:c1bf:5f4c:ff8a:9e0c]:5432 dial tcp [2406:da14:271:9903:c1bf:5f4c:ff8a:9e0c]:5432: connect: no route to host

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 11
  • Comments: 21 (2 by maintainers)

Most upvoted comments

We have identified the problem and will be rolling out a fix soon. Thanks for reporting.

Was getting connect: network is unreachable. Now I’m getting Authorization failed for the access token and project ref pair: {"message":"Cannot GET /***/***/***/***?reveal=false"}

TCP connection seems to work now, but now I’m also getting an authorization error now :

Supabase CLI 2.19.7
...(abbreviated logs)...
2025/03/18 15:02:20 Sent Header: :authority [api.supabase.com]
2025/03/18 15:02:20 Sent Header: :method [GET]
2025/03/18 15:02:20 Sent Header: :path [/v1/projects/***]
2025/03/18 15:02:20 Sent Header: :scheme [https]
2025/03/18 15:02:20 Sent Header: authorization [***
2025/03/18 15:02:20 Sent Header: user-agent [SupabaseCLI/2.19.7]
2025/03/18 15:02:20 Sent Header: accept-encoding [gzip]
2025/03/18 15:02:20 Send Done
2025/03/18 15:02:20 Recv First Byte
2025/03/18 15:02:20 Sent Header: :authority [api.supabase.com]
2025/03/18 15:02:20 Sent Header: :method [GET]
2025/03/18 15:02:20 Sent Header: :path [/v1/projects/***/api-keys?reveal=false]
2025/03/18 15:02:20 Sent Header: :scheme [https]
2025/03/18 15:02:20 Sent Header: authorization [***
2025/03/18 15:02:20 Sent Header: user-agent [SupabaseCLI/2.19.7]
2025/03/18 15:02:20 Sent Header: accept-encoding [gzip]
2025/03/18 15:02:20 Send Done
2025/03/18 15:02:20 Recv First Byte
Authorization failed for the access token and project ref pair: {"message":"Cannot GET /v1/projects/***/api-keys?reveal=false"}

Update: It seems to be working again. Thanks @sweatybridge !

Experienced same behavior in last 30 minutes (no prior issues on this flow)

Run supabase link --project-ref $SUPABASE_PROJECT_ID --debug
Supabase CLI 2.19.7

...(abbreviated logs)...
2025-03-18T12:55:09.2239336Z Connecting to remote database...
2025-03-18T12:55:09.2446375Z failed to connect to postgres: failed to connect to `host=db.***.supabase.co user=postgres database=postgres`: dial error (dial tcp [2a05:d014:1c06:5f14:4987:ec54:c7e3:3f59]:5432: connect: network is unreachable)
2025-03-18T12:55:09.2448818Z Try rerunning the command with --debug to troubleshoot the error.

Experiencing the same issue in my github actions workflow. Several retries resulted in the same outcome. The workflow ran for more than a year without any of these kind of issues.

Shortened log output:

Run supabase link --project-ref $SUPABASE_PROJECT_ID --debug
Supabase CLI 2.19.7

...(abbreviated logs)...

025/03/18 12:39:44 Connect Error: tcp [2600:1f18:2e13:9d0b:5cb9:1ef6:7858:9c8e]:5432 dial tcp [2600:1f18:2e13:9d0b:5cb9:1ef6:7858:9c8e]:5432: connect: network is unreachable
failed to connect to postgres: failed to connect to `host=db.***.supabase.co user=postgres database=postgres`: dial error (dial tcp [2600:1f18:2e13:9d0b:5cb9:1ef6:7858:9c8e]:5432: connect: network is unreachable)

Fixed for my case too! Thanks for the team resolving this.

Same issue. Wasn’t sure where to post the issue, but now I know! Thanks Supabase Staff!

Same issue with Github Actions and Supabase CLI 2.19.7 (installed using supabase/setup-cli@v1 with version: latest).

EDIT: Apparently Supabase team is already aware and looking into it https://github.com/orgs/supabase/discussions/17817#discussioncomment-12538898

Experiencing the same issue, tried to use different versions of the cli, the issue persists.

$ npx supabase@2.20.2 link
Selected project: wspyogpliv....
Enter your database password (or leave blank to skip):
Connecting to remote database...
failed to connect to postgres: failed to connect to `host=db.wspyogplivbbcnisxuiq.supabase.co user=postgres database=postgres`: dial error (timeout: dial tcp [2a05:d01c:30c:9d01:b8b5:407c:7cfa:58ec]:5432: i/o timeout)
Try rerunning the command with --debug to troubleshoot the error.

...alert/backend (rewrite)
$ npx supabase@2.15.8 link
Need to install the following packages:
supabase@2.15.8
Ok to proceed? (y) y

Selected project: wspyogpliv....
Enter your database password (or leave blank to skip):
Connecting to remote database...
failed to connect to postgres: failed to connect to `host=db.wspyogplivbbcnisxuiq.supabase.co user=postgres database=postgres`: dial error (timeout: dial tcp [2a05:d01c:30c:9d01:b8b5:407c:7cfa:58ec]:5432: i/o timeout)
Try rerunning the command with --debug to troubleshoot the error.