Skip to content

fix(cli): distinguish local vs. remote connection-refused hints (CLI-1995) - #5979

Merged
annabkr merged 5 commits into
developfrom
annabaker/cli-1995-db-advisors-local-connection-refused-error-points-to-remote
Jul 29, 2026
Merged

fix(cli): distinguish local vs. remote connection-refused hints (CLI-1995)#5979
annabkr merged 5 commits into
developfrom
annabaker/cli-1995-db-advisors-local-connection-refused-error-points-to-remote

Conversation

@annabkr

@annabkr annabkr commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

The Go implementation's SetConnectSuggestion has no local vs. remote distinction, so a refused --local connection (Postgres/Docker not running) inherited the same hint as an actual network-restricted remote connection, directing the user to their project's settings dashboard.

This is a dead end for a local user, since there's nothing to fix on the dashboard.

Changes

  • Add LEGACY_SUGGEST_LOCAL_STACK message and thread an isLocal flag through legacyConnectSuggestion so a refused local connection now suggests starting Docker (supabase start) instead.
  • Split the single "connection refused" branch:
    • ECONNREFUSED/"connection refused" now branches on ctx.isLocal
    • "Address not in tenant allow_list" is only ever from the remote pooler so the previous message stays unconditionally.
  • Ensure unit and integration test coverage

Before (running with --local)

Connecting to local database...
failed to connect to postgres: failed to connect to `host=127.0.0.1 user=x database=y`: dial error (connect ECONNREFUSED 127.0.0.1:54322)
Make sure your local IP is allowed in Network Restrictions and Network Bans. $remoteProjectSettingsUrl

After (running with --local)

Connecting to local database...
failed to connect to postgres: failed to connect to `host=127.0.0.1 user=x database=y`: dial error (connect ECONNREFUSED 127.0.0.1:54322)
Make sure Docker is running, then run: supabase start

Linked issue

Closes CLI-1995

  • I'm a Supabase maintainer

Checklist

  • The PR title follows Conventional Commits (e.g. fix(cli): …).
  • Tests added or updated for the change.
  • pnpm check:all and pnpm test pass for the workspace(s) I touched.

I also ran the compiled legacy binary and validated the --linked and --local paths.

@annabkr

annabkr commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 9039d2e099

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@annabkr
annabkr marked this pull request as ready for review July 28, 2026 18:26
@annabkr
annabkr requested a review from a team as a code owner July 28, 2026 18:26

@kanadgupta kanadgupta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit below otherwise looks good to me! Will defer to @Coly010 for final merge

Comment thread apps/cli/src/legacy/shared/legacy-connect-errors.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9039d2e099

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/cli/src/legacy/shared/legacy-connect-errors.ts
@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Supabase CLI preview

npx --yes https://pkg.pr.new/supabase/cli/supabase@195a7f91a00fa6728439cc09bb6ff08adcc2b711

Preview package for commit 195a7f9.

Comment thread apps/cli-e2e/src/tests/database-core.e2e.test.ts
@annabkr
annabkr requested a review from Coly010 July 28, 2026 19:31

@Coly010 Coly010 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you :)

…-db-advisors-local-connection-refused-error-points-to-remote
@annabkr
annabkr added this pull request to the merge queue Jul 29, 2026
Merged via the queue into develop with commit dcf4443 Jul 29, 2026
14 checks passed
@annabkr
annabkr deleted the annabaker/cli-1995-db-advisors-local-connection-refused-error-points-to-remote branch July 29, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants