Skip to content

failed to connect to postgres #3960

@andim27

Description

@andim27

Describe the bug
Error connection to postgres after migration error

To Reproduce
Steps to reproduce the behavior:

  1. Create migration files

  2. supabase db push
    Ask:
    Do you want to push these migrations to the remote database?
    yes
    Applying migration 20250730155824_my_data.sql...
    Applying migration 20250731151101_next_data.sql...
    ERROR: syntax error at or near "" (SQLSTATE 42601)
    At statement: 0
    \set ON_ERROR_STOP off
    ^
    Try rerunning the command with --debug to troubleshoot the error.

  3. supabase db push

  4. See error
    Connecting to remote database...
    failed to connect to postgres: failed to connect to host=aws-0-eu-central-2.pooler.supabase.com user=cli_login_postgres.myId database=postgres: AfterConnect error (ERROR: permission denied to set role "postgres" (SQLSTATE 42501))
    Try rerunning the command with --debug to troubleshoot the error.

6 !!!!!!!!!!!!!!!
supabase unlink
supabase link --project-ref myId
Initialising cli_login_postgres role...
Connecting to remote database...
failed to connect to postgres: failed to connect to host=aws-0-eu-central-2.pooler.supabase.com user=cli_login_postgres.myId database=postgres: AfterConnect error (ERROR: permission denied to set role "postgres" (SQLSTATE 42501))

  1. !!!!! NO CONNECTION AT ALL !!!!!
  2. How to work??????

System information
Rerun the failing command with --create-ticket flag.

  • Ticket ID: [e.g. ab1ac733e31e4f928a4d7c8402543712]
  • Version of OS:mac os
  • Version of CLI: 2.33.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions