psql proxy connection not working per instructions

Following this guide: Connect With flyctl · Fly Docs

I have routed the port to 15432 . But when I attempt to connect with:

psql postgres://postgres:<password>@localhost:15432 (yes I am using the proper password) I get:

psql: error: connection to server at "localhost" (127.0.0.1), port 15432 failed: FATAL: password authentication failed for user "postgres"

Is this an issue with my local postgres configuration or is the proxied server not correct?

That error strongly indicates that the proxy works because otherwise you’d get connection reset or other errors not a specific one about password.

My suggestions:

  • Use fly ssh console -a postgres-app to list envs using env and confirm your password.
  • Try to use psql with -U postgres instead of putting it on the url and let the password prompt appear so you can type it interactively to test.

I wasn’t suggesting the proxy isn’t working, this is a configuration issue and I suspect it is on Fly’s end. The guides are saying the postgres username is available and does not indicate otherwise. The error I’m getting is telling me this is not the case. Fly’s own guides feel wrong here

$ fly ssh console -a app-name-db
Connecting to fdaa:0:5463:a7b:101:ff5a:9797:2... complete
root@6e82d44df76458:/# env | grep OPERATOR_PASSWORD
OPERATOR_PASSWORD=<Redacted>

$ psql "postgres://localhost:15432" -U postgres
Password for user postgres:
psql (14.8 (Homebrew), server 15.3 (Debian 15.3-1.pgdg110+1))
WARNING: psql major version 14, server major version 15.
         Some psql features might not work.
Type "help" for help.

postgres=#\q

$ psql "postgres://postgres:<Redacted>@localhost:15432"
psql (14.8 (Homebrew), server 15.3 (Debian 15.3-1.pgdg110+1))
WARNING: psql major version 14, server major version 15.
         Some psql features might not work.
Type "help" for help.

postgres=#\q

The postgres role is created, you can retrieve it’s password by ssh-ing into the DB and looking for OPERATOR_PASSWORD and connect. You can also confirm users list by:

$ fly pg users list -a app-name-db
NAME       	SUPERUSER	DATABASES
flypgadmin 	yes      	<Redacted db name>, postgres, repmgr
postgres   	yes      	<Redacted db name>, postgres, repmgr
repmgr     	yes      	<Redacted db name>, postgres, repmgr

I retract my previous message then as you are correct! I think the issue here is that I didn’t use the OPERATOR_PASSWORD and used another I found on the app instance and that password was not linked to the postgres username. Apologies and thank you!

1 Like

I’m glad it’s working! The secrets can definitely make a lot of room for confusion, I could have said the correct secret name upfront. Thanks for following up

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.