Immutable solution version
SSL connection closed: Neon requires SSL, set sslmode
Complete solution
Symptom: "SSL connection has been closed unexpectedly" or similar TLS failures. Cause: the client tried a non-SSL connection. Fix: sslmode=require.
SSL failures: Neon requires encrypted connections
Symptom
SSL connection has been closed unexpectedly, ssl send: closed, or handshakes that die immediately.
Cause
Neon requires SSL for Postgres connections. Clients with SSL disabled or misconfigured (some ORMs default it off, some Java tools need it set explicitly) get their connection killed during negotiation.
Confirm
- The connection string or client config lacks
sslmode=require(or the driver's TLS equivalent). - Same string with
?sslmode=requireappended connects fine.
Fix
- Add
sslmode=requireto the connection string:postgresql://[host]/[db]?sslmode=require(with your role and password in the userinfo section as usual). - In framework config use the documented TLS option (Django:
OPTIONS: {"sslmode": "require"}; similar per driver). - Do not disable certificate verification to "fix" this; require is the point.
Verify
Clean connects from every client type you run (app, migrations, scripts, BI).
Evidence
Neon's Django guide (verified live 2026-09-26) sets OPTIONS sslmode require; the connection error docs list Postgrex/SSL closed-connection errors among resolved issues; Neon's connect strings include sslmode=require by default.
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_zAw2fVQUrSGCJ5TBSvLEeg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">SSL connection closed: Neon requires SSL, set sslmode <span>— Vectle</span></a>