How do I fix "authentication type 10 is not supported" when connecting to Heroku Postgres Essential databases?

Issue

I'm receiving authentication-related errors like the following ones when attempting to connect to a Heroku Postgres Essential database:

Caused by: org.postgresql.util.PSQLException:
The authentication type 10 is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or subnet, and that it is using an authentication scheme supported by the driver.

or,

org.postgresql.util.PSQLException:
SCRAM authentication is not supported by this driver.
You need JDK >= 8 and pgjdbc >= 42.2.0 (not ".jre" vesions)

Resolution

Databases running on Heroku Postgres Essential plans (essential-*) use SCRAM authentication.

The PostgreSQL drivers used in your apps or services that connect to Heroku Postgres Essential databases must support the SCRAM-SHA-256 authentication protocol (authentication type 10).

For reference, find here a list of PostgreSQL drivers for different programming languages and their compatibility with SCRAM.

Any drivers that rely on libpq, which Heroku keeps up-to-date in our Stacks, should generally be compatible and support SCRAM authentication. If you run container-based apps on Heroku, please make sure you install a recent version of the libpq library (version 10 or higher).

If you're using a programming language whose PostgreSQL drivers don't use libpq, make sure you're using a SCRAM-compatible driver and upgrade it to the require version that includes SCRAM support. For example, for these non-libpq based drivers, you can use node-postgres v7.9.0+ for Node.js apps, JDBC 42.2.0+ for Java apps, or lib/pq 1.1.0+ for Go (or any other compatible driver/version of your choice).


All databases using the EOL mini and basic plans are being automatically migrated to the new essential-0 and essential-1 plans respectively. After these migrations, customers might experience connectivity issues if their PostgreSQL drivers are not compatible with SCRAM authentication. Heroku is built to be erosion-resistant, but eventually libraries will require to be updated to ensure that your app continues running in a safe and stable manner in our platform.

Databases in the Standard, Premium, Private and Shield tiers don't require SCRAM authentication. As an alternative and temporary measure, while you work to update your PostgreSQL drivers to support SCRAM authentication for Essential databases, you can also upgrade your database to the standard-0 plan. Use the pg:copy plan upgrade method to upgrade your database from essential-* to standard-0 or higher.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support