FluentDBFluentDB
PostgreSQL errors

PostgreSQL: SSL connection is required

FATALSQLSTATE 28000invalid_authorization_specification
FATAL: SSL connection is required

The server requires an encrypted connection, and your client connected without one, or without a required client certificate. Set sslmode=require (or verify-full) in your connection string.

What this error means

Many servers, especially managed Postgres on RDS, Cloud SQL, Azure, and Heroku, only accept SSL connections. If your client connects in plaintext, or without a required client certificate, the server refuses it.

On self-managed Postgres this comes from a hostssl rule in pg_hba.conf that has no plaintext fallback.

How to fix it

01

Your client connects without SSL

Turn SSL on in the connection string.

text
postgresql://user@host:5432/db?sslmode=require
02

The server verifies a client certificate

Provide the client certificate and key.

text
postgresql://user@host:5432/db?sslmode=verify-full&sslcert=client.crt&sslkey=client.key&sslrootcert=ca.crt
03

Local development only

If you want plaintext in dev, change the pg_hba rule from hostssl to host and reload. Do this only in development.

How to avoid it next time

  • Default to sslmode=require for any connection over a network.
  • Use verify-full with the provider CA certificate in production.

Frequently asked questions

Which sslmode should I use?

require encrypts the connection. verify-full also checks the server certificate against a CA, which is what you want in production.

Why does my managed database demand SSL?

Providers like RDS and Cloud SQL enforce SSL to protect data in transit. Set sslmode=require and supply the provider CA certificate.

Stop struggling with SQL

Use FluentDB, the AI database client for macOS.