Search code examples
postgresqlspring-bootherokuheroku-postgres

Heroku : org.postgresql.util.PSQLException: The server does not support SSL


We are planning to migrate our Spring Boot app from AWS to Heroku. As part of which today we tried to deploy our war file to Heroku server via cli. The deployment was successful, but on start up we get the error org.postgresql.util.PSQLException: The server does not support SSL

We are using a postgresql database and do use SSL to connect to it. Below is the a portion of .yml

datasource:
    password: <PASSWORD>
    url: jdbc:postgresql://<HOSTNAME>:5432/<DBNAME>
    username: <USERNAME>
    continue-on-error: true

A solution found while searching was to provide ?ssl=false at the end of the connection URL like shown below:

datasource:
    password: <PASSWORD>
    url: jdbc:postgresql://<HOSTNAME>:5432/<DBNAME>?ssl=false
    username: <USERNAME>
    continue-on-error: true

But we still get the same error. How do we fix this ? The war works fine in AWS.


Solution

  • This issue was solved by changing the connection URL in .yml file as shown below:

    datasource:
        password: <PASSWORD>
        url: jdbc:postgresql://<HOSTNAME>:5432/<DBNAME>?sslmode=disable
        username: <USERNAME>
        continue-on-error: true
    

    Can find more info here