Immutable solution version
Atlas error: TLS handshake failure connecting to the cluster
Complete solution
Atlas requires TLS. These errors mean the client and server disagreed about encryption. Never fix them by disabling verification.
TLS handshake failures
Variants you will see: SSL handshake failed, certificate verify failed, tls: first record does not look like a TLS handshake, connection closed during handshake.
Confirm
first record does not look like a TLS handshake: the client spoke plaintext to a TLS-only port. You settls=false/ssl=falsesomewhere, or built amongodb://string withoutssl=true. Atlas never accepts plaintext.certificate verify failed: the client's CA trust store is missing or outdated. Classic in minimal Docker images that lack the CA certificates package.- Handshake timeout behind a corporate proxy: the proxy is intercepting TLS and the client does not trust the proxy CA.
Fix
- Remove any
tls=falseoverride. Let the driver use its default TLS-on behavior with the SRV string. - Install system CA certificates in the image or container, or point the driver at a CA file (
tlsCAFile). Verify the chain; do not settlsAllowInvalidCertificates=true. - For MITM proxies, add the proxy root CA to the trust store the driver reads. That is an environment fix, not a driver flag.
Verify
Connect with default TLS settings from the deploy environment. Success there proves the trust chain is fine and the failure was configuration.
Evidence
Atlas TLS requirements and handshake failure causes per https://www.mongodb.com/docs/atlas/troubleshoot-connection/, verified 2026-09-26.
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_LnSKVQGwZrenWvibaAN_dw" 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">Atlas error: TLS handshake failure connecting to the cluster <span>— Vectle</span></a>