You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Small DX improvement around an error message when host cannot access the DB due to network restrictions.
What is the current behavior?
Setup
Restrict all access for a project's database
Attempt to perform go run . db push
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
No actionable comments were generated in the recent review. 🎉
📝 Walkthrough
Summary by CodeRabbit
Bug Fixes
Improved error messages and suggestions when connection attempts fail, providing clearer guidance for various failure scenarios including SSL configuration, authentication, and network issues.
Refactor
Centralized connection error handling to streamline error messaging logic.
Walkthrough
The pull request refactors connection error handling by extracting inline error-inspection logic into a new exported function SetConnectSuggestion(err error). This function parses error messages to recognize specific connection failure scenarios, including "Address not in tenant allow_list", SSL requirements, authentication failures, and host-not-found errors. A new exported constant SuggestEnvVar provides the password-related hint. The changes centralize error-based messaging logic and update call sites in db_url.go to delegate error handling to the new function with fallback logic.
Assessment against linked issues
Objective
Addressed
Explanation
Recognize and communicate "Address not in tenant allow_list" errors [#3064]
✅
Recognize and communicate "Wrong password" / SCRAM authentication errors [#3064]
✅
Provide clearer, more specific error messages for connection failures [#3064]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
go run . db pushWhat is the new behavior?
sanity check, tested without the network restrictions:
Additional context
Two things to note:
supabase db pushis thatsupabase linkseems to no longer connect directly to the db - this issue was originally filed more than a year ago.error received from server in SCRAM exchange: Wrong passwordscenario mentioned in the issue. I wonder if this is related to the changes above tosupabase link