Postico icon indicating copy to clipboard operation
Postico copied to clipboard

Pre-connect shell script not working

Open ybasket opened this issue 1 year ago • 2 comments

What did you do?

  • I set connection favourites for both a localhost (Docker, Postgres 16) and an AWS RDS (Postgres 16, no proxy) server
  • When connecting, everything works fine and I can see the database contents
  • Then, I tried to enable a Pre-connect shell script on them, but no matter the script or database, the authentication fails. Examples
#!/bin/bash
cat <<eof
{
"sslmode":"prefer"
}
eof
echo "$PGPASSWORD"
echo "[hardcoded password]"

I had the scripts print their output to stderr, it looks exactly as I'd expect, either the plain password or the JSON.

What did you expect to happen?

  • No change, still being able to connect as without the script

What actually happened?

  • The authentication fails with
The server rejected the password provided by the pre-connect shell script.

This is similar to #875, but different from there, it always fails and not only when using RDS Proxy.

What software versions are you using?

Postico version:
Version 2.1 dev (9685) – but I also tried 9669.

macOS version:
14.4.1 (23E224)

PostgreSQL version:
16.1 on AWS RDS, postgres:16-alpine via Docker

ybasket avatar Jun 19 '24 10:06 ybasket

It looks like I really need to add some kind of debug button for shell scripts. It's impossible to tell what password Postico is trying to use.

Is it possible you have something in your bash profile that prints something to stdout?

jakob avatar Jun 19 '24 10:06 jakob

It looks like I really need to add some kind of debug button for shell scripts. It's impossible to tell what password Postico is trying to use.

That would indeed be great. Little side request: I'd also appreciate if Undo/Redo would work on the script text field.

Is it possible you have something in your bash profile that prints something to stdout?

Not that I'm aware of. I'm usually using zsh where oh-my-zsh could interfere, but I explicitly added shebangs like #!/bin/bash and #!/bin/sh and these shells definitely have no special setups. Didn't help, the behaviour is the same.

ybasket avatar Jun 19 '24 12:06 ybasket