Verified Developer Solution • 100% OfflineFix "unable to get local issuer certificate" in Node.js
Solve UNABLE_TO_GET_ISSUER_CERT_LOCALLY errors when making requests to HTTPS endpoints.
Your HTTP request fails with `UNABLE_TO_GET_ISSUER_CERT_LOCALLY`. Node.js cannot verify the server's SSL certificate because it lacks the root CA or the server didn't send the intermediate certificates.
Avoid setting `NODE_TLS_REJECT_UNAUTHORIZED=0`. Instead, fix the server's certificate chain (include the intermediate certs), or manually supply the custom root CA to your Node.js HTTPS agent.
Code Standard: Bad Pattern vs Verified Fix
Live Syntax1// ❌ Bad: Disabling TLS verification globally2process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';3 4// ✅ Good: Passing the custom CA5const agent = new https.Agent({ ca: fs.readFileSync('custom-ca.pem') });6axios.get('https://internal.api', { httpsAgent: agent });Test and resolve this using X.509 Certificate & CSR Decoder
Execute directly in your browser memory. Zero API keys, zero network tracking, completely client-side.
Frequently Asked Questions
Q:Why does this work in Chrome but fail in Node?
Browsers dynamically fetch missing intermediate certificates (AIA fetching) and have larger trust stores. Node.js is strict and only trusts bundled CAs.
Q:How do I inspect my certificate chain?
Use our X.509 Certificate Decoder to inspect your server's PEM files.