fix: clarify db connection error for `Address not in tenant allow_list` by samirketema · Pull Request #4873 · supabase/cli

What kind of change does this PR introduce?

Fixes #3064

Small DX improvement around an error message when host cannot access the DB due to network restrictions.

What is the current behavior?

Setup

  1. Restrict all access for a project's database
  2. Attempt to perform go run . db push
  3. Note at the error in the output.
failed to connect as temp role: failed to connect to `host=aws-1-us-east-1.pooler.supabase.com user=cli_login_postgres.xhhcxixppntgjgrwlxol database=postgres`: server error (FATAL: Address not in tenant allow_list: {216, 232, 45, 154} (SQLSTATE XX000))
Connect to your database by setting the env var: SUPABASE_DB_PASSWORD
exit status 1

What is the new behavior?

failed to connect as temp role: failed to connect to `host=aws-1-us-east-1.pooler.supabase.com user=cli_login_postgres.xhhcxixppntgjgrwlxol database=postgres`: server error (FATAL: Address not in tenant allow_list: {216, 232, 45, 154} (SQLSTATE XX000))
Make sure your local IP is allowed in Network Restrictions and Network Bans.
https://supabase.com/dashboard/project/_/database/settings
exit status 1

sanity check, tested without the network restrictions:

Remote database is up to date.

Additional context

Two things to note:

  • The reason why I tested this via supabase db push is that supabase link seems to no longer connect directly to the db - this issue was originally filed more than a year ago.
  • I was unable to reproduce the error received from server in SCRAM exchange: Wrong password scenario mentioned in the issue. I wonder if this is related to the changes above to supabase link