Steven
Steven

Reputation: 1258

Heroku Postgres database plan change results in crashing application

I just moved my data for a heroku application to a bigger database of a newer version. When restarting the application, I got an error, that has been widely discussed when connecting to databases outside of heroku.

app[web.1]: Caused by: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "XX.XX.XX.XX", user "12345678901234", database "12345678901234", SSL off

The heroku FAQ states:

You are attempting to establish a database connection without SSL. SSL is required for connections [...] for all connections on some newer databases on -0 and -2 plans. Please see the documentation for your postgres driver on how to establish encrypted connections.

I don't have access to the postgres options of my heroku instance, do I? Am I missing any simple information?

Additional information: I am working with Play Framework 2.3.7 with Java. The connection is handled by Heroku with an unmutable value in an environment variable. The infrastructure is managed using Heroku Toolbelt.

Upvotes: 0

Views: 196

Answers (1)

codefinger
codefinger

Reputation: 10318

You probably have something like this in your build.sbt:

"postgresql" % "postgresql" % "9.1-901-1.jdbc4"

Change it to this:

"org.postgresql" % "postgresql" % "9.4.1208"

This will use SSL by default as described in the Heroku Postgresql documentation.

If you cannot upgrade the library, you must manually add these parameters to the DATABASE_URL.

ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory

Upvotes: 1

Related Questions