Rey Libutan Rey Libutan - 1 year ago 217
Java Question

Heroku - FATAL: password authentication failed for user <>

First of all, I created PostgreSQL DB in Heroku. I manually created my DB/schema/tables through pgAdmin remote access. I know I succeeded since it updated my row limit.

Now, I am deploying a Spring Boot application.
No DB props/credentials are found in my
file since I am supposed to do this in Heroku Config Vars. For example, my DB username is janxgspmlpjgbn

Project builds successfully, however, in the logs I see that it has this exception.

2016-09-28 16:12:31.184 [ERROR] org.apache.juli.logging.DirectJDKLog.log:181 - Unable to create initial connections of pool.
2016-09-28T16:12:31.185772+00:00 app[web.1]: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "u24453"


Why does it fail for the user u24453 (by the way this user changes every time I redeploy) when in my Config Var, I typed the user janxgspmlpjgbn?


Here's how my Config Vars look right now:
enter image description here

Answer Source

u24453 is probably the OS user name (the one Heroku creates for your app as it runs on Ubuntu Linux).

I believe the Postgres Driver will use the OS username as your DB username by default (if a username is not provided). Thus, I suspect the DB username is not getting into the configuration properly.

In your application.yml you should have this:


For more info see Connecting to Relational Databases on Heroku with Java

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download