fix(cli): detect IPv6 connectivity errors and suggest the IPv4 pooler#5493
Open
avallete wants to merge 2 commits into
Open
fix(cli): detect IPv6 connectivity errors and suggest the IPv4 pooler#5493avallete wants to merge 2 commits into
avallete wants to merge 2 commits into
Conversation
Supabase direct database connections (db.<ref>.supabase.co:5432) are IPv6-only unless the IPv4 add-on is enabled. Users on IPv4-only networks hit confusing failures: - in-process commands (db push/pull, migration repair) surfaced "network is unreachable" with no hint, or "no route to host" misreported as "make sure your project exists". - `supabase db dump` runs pg_dump inside a Docker container whose stderr is streamed to the terminal but never classified, so the connection failure only showed up as "error running container: exit 1". Detect the IPv6 signatures (network unreachable / no route to an IPv6 literal / libpq "Address family for hostname not supported") and point the user at the IPv4 connection pooler via `supabase link`. For db dump, tee the container's stderr so the failure can be classified after the generic container exit code. https://claude.ai/code/session_01UaPk7dGPmiCqoKJHyV7SLz
ae9ab9c to
2156bff
Compare
Coverage Report for CI Build 27054386938Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Warning No base build found for commit Coverage: 64.121%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase@5493Preview package for commit |
A real-world db dump on an IPv4-only network surfaced "could not translate host name ... to address: No address associated with hostname" (getaddrinfo EAI_NODATA): the host is IPv6-only and the container has no IPv6 stack, so AI_ADDRCONFIG filters out the AAAA record. The previous detection only matched the address-family variant, so the IPv6 suggestion never fired. Match the EAI_NODATA message too, and cover it with the existing connect-suggestion and db dump tests. https://claude.ai/code/session_01UaPk7dGPmiCqoKJHyV7SLz
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes CLI-1593
What
When a database host resolves to an IPv6-only address and the network (or the Docker container) has no IPv6 route, the CLI now detects the failure and tells the user to connect through the IPv4 connection pooler:
Why
Supabase direct database connections (
db.<ref>.supabase.co:5432) are IPv6-only unless the IPv4 add-on is enabled. Users on IPv4-only networks previously hit confusing failures:db push/db pull, migration repair) surfacednetwork is unreachablewith no hint, orno route to hostmisreported as "make sure your project exists".supabase db dumprunspg_dumpinside a Docker container whose stderr is streamed to the terminal but never classified, so the real connection error only showed up aserror running container: exit 1— the exact symptom reported in CLI-1593.How
SetConnectSuggestion(internal/utils/connect.go) now recognizes the IPv6 signatures:network is unreachable,no route to hostagainst a bracketed IPv6 literal, and libpq'sAddress family for hostname not supported. It's ordered before the existingno route to host/Tenant or user not foundbranch, and the literal/phrase gating keeps genuine project-not-found and Supavisor tenant errors on their existing suggestion.db dump(internal/db/dump/dump.go) tees the container's stderr into a buffer and, on failure, runs it throughSetConnectSuggestionso the IPv6 guidance surfaces instead of the bare container exit code.Notes
dbcommands are still proxied to the bundled Go binary, so the fix lives inapps/cli-go; the TS proxy forwards the suggestion on stderr unchanged.https://claude.ai/code/session_01UaPk7dGPmiCqoKJHyV7SLz
Generated by Claude Code