Node/OpenSSL: Error: self signed certificate (code: DEPTH_ZERO_SELF_SIGNED_CERT)
The server presented a self-signed certificate (issuer equals subject), which no CA vouches for.
Error: self signed certificateverify error:num=18:self signed certificateself-signed certificate (code: DEPTH_ZERO_SELF_SIGNED_CERT) Meaning
Fine for local testing, not for production. For development, trust the certificate explicitly (add it to the client's CA list) or use mkcert to create a locally trusted CA. For production use a CA-issued certificate (Let's Encrypt is free).
Common causes
- Development server with a self-signed cert
- Appliance default certificate
- Internal service never given a CA cert
- Docker image generating a throwaway cert
- Misconfigured proxy returning its own cert
⚡ Quick fix
- Use mkcert for local development
- Get a Let's Encrypt certificate for public hosts
- Pin or trust the specific cert in the client for internal tools
Detailed fix by platform
Linux
mkcert -install && mkcert localhost 127.0.0.1 ::1
How to diagnose
- Issuer — Same as subject?
- Env — Dev or prod?
- Trust — Can the client trust it explicitly?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- AH01909: server certificate does NOT include an ID which matches the server name Apache: [ssl:warn] AH01909: example.com:443:0 server certificate does NOT include an ID which matches the server name
- CAA record forbids issuance Let's Encrypt/CA: CAA record for example.com prevents issuance
- curl: (60) SSL certificate problem curl: (60) SSL certificate problem: unable to get local issuer certificate
Most viewed in SSL / TLS
- NET::ERR_CERT_COMMON_NAME_INVALID NET::ERR_CERT_COMMON_NAME_INVALID: Your connection is not private (certificate is for a different domain)
- Challenge failed for domain Let’s Encrypt / Certbot: Challenge failed for domain example.com — Invalid response from http://example.com/.well-known/acme-challenge/x: 404
- no start line OpenSSL: unable to load certificate / PEM routines:get_name:no start line (key values mismatch)
Other ways to find it
Where this error sits
Origin: Network. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026