Why did the crash with Play / Heroku / Postgres fail with a password error?

I'm starting with the Play Framework and I have a toy application that runs locally using an in-memory H2 database. My application.conf file looks like this:

 db.default.driver=org.h2.Driver db.default.url="jdbc:h2:mem:my-app-db" db.default.user=sa db.default.password="" 

However, when I try to deploy the application to Heroku using the Postgres database that they provide, the deployment fails:

 org.postgresql.util.PSQLException: FATAL: password authentication failed for user "sa" 2013-05-17T01:22:18.982766+00:00 app[web.1]: at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66) 2013-05-17T01:22:18.982827+00:00 app[web.1]: at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125) 2013-05-17T01:22:18.983634+00:00 app[web.1]: at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:112) 2013-05-17T01:22:18.982915+00:00 app[web.1]: at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30) 2013-05-17T01:22:18.982665+00:00 app[web.1]: at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:108) 2013-05-17T01:22:18.982981+00:00 app[web.1]: at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:22) 2013-05-17T01:22:18.983376+00:00 app[web.1]: at java.sql.DriverManager.getConnection(DriverManager.java:200) 

My Procfile exactly as described in the Procfile guide:

 web: target/start -Dhttp.port=${PORT} ${JAVA_OPTS} -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver -Ddb.default.url=${DATABASE_URL} 
+4
source share
1 answer

The problem was that these two properties interfered with Postgres:

 db.default.user=sa db.default.password="" 

(Postgres already has a username and password in the URL, as you can see if you are heroku config and see the DATABASE_URL property.)

When I commented on these two lines and clicked on Heroku again, Postgres worked correctly, and H2 still worked locally.

+7
source

Source: https://habr.com/ru/post/1481304/


All Articles