Fix "unable to verify the first certificate" & UNABLE_TO_VERIFY_LEAF_SIGNATURE
Node.js rejected an HTTPS request because the destination SSL/TLS certificate chain is incomplete (missing intermediate CA certificate) or issued by an untrusted corporate proxy.
FetchError: unable to verify the first certificate / UNABLE_TO_VERIFY_LEAF_SIGNATURE
Quick Fix Checklist
- On server: Ensure Nginx/Apache serves fullchain.pem (certificate + bundle), not cert.pem alone
- For corporate VPNs: Export root certificate and run NODE_EXTRA_CA_CERTS=/path/to/ca.pem
- Never set NODE_TLS_REJECT_UNAUTHORIZED='0' in production