setup-cli icon indicating copy to clipboard operation
setup-cli copied to clipboard

Unable to access postgres DB when using `setup-cli`- what's the password?

Open jason-curtis opened this issue 1 year ago • 2 comments

Bug report

  • [x] I confirm this is a bug with Supabase, not with my own application.
  • [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Can't authenticate against the db that setup-cli creates. Can't figure out how to obtain/set the correct password.

To Reproduce

The following GitHub Action config fails with error FATAL: password authentication failed for user "postgres" (example log).

The action attempts to set up the correct password in 2 ways:

  • Using the password listed at https://supabase.com/docs/guides/self-hosting/docker#accessing-postgres (your-super-secret-and-long-postgres-password)
  • Setting the password in a .env file as specified at https://supabase.com/docs/guides/self-hosting/docker#update-secrets .
jobs:
  supabase-issue-repro:
    runs-on: ubuntu-latest
    env:
      POSTGRES_PASSWORD: your-super-secret-and-long-postgres-password
      SUPABASE_CLI_VERSION: 1.148.6
    steps:
      - name: Configure .env for supabase
        run: echo "POSTGRES_PASSWORD=${{ env.POSTGRES_PASSWORD }}" >> .env
      - uses: supabase/setup-cli@v1
        with:
          version: ${{ env.SUPABASE_CLI_VERSION }}
      - run: supabase init
      - run: supabase start
      - env:
          PGPASSWORD: ${{ env.POSTGRES_PASSWORD }}
        run: psql -h localhost -p 54322 -U postgres -c "CREATE DATABASE test;"

I've also attempted to connect using prisma, but no luck.

Expected behavior

I can interact with the DB using prisma or psql

Screenshots

image

System information

  • ubuntu-latest GitHub actions runner.
  • tried with supabase CLI version 1.148.6 and 1.136.3 (version mentioned in README.md)

jason-curtis avatar Mar 20 '24 23:03 jason-curtis

The local development container password is hardcoded as postgres for simplicity. Do you need to change it?

sweatybridge avatar Mar 21 '24 02:03 sweatybridge

No, I don’t need to change it! It’s sufficient to just know that the password is ‘postgres’ I suppose.

would you accept a pull request with documentation that specifies the hardcoded password (and unusual port, 54322)? Maybe as an additional advanced example in the README.

jason-curtis avatar Mar 21 '24 03:03 jason-curtis