Axioserror unable to get local issuer certificate means Axios cannot verify the SSL chain for the HTTPS server you are calling.
What Axioserror Unable To Get Local Issuer Certificate Means
When your code throws the message axioserror unable to get local issuer certificate, Axios is telling you that Node.js failed to trust the TLS certificate that came back from the remote server. Under the hood Axios relies on the https module, which in turn uses OpenSSL and the system trust store to decide whether a certificate chain is safe to use for HTTPS.
SSL and TLS use a chain of trust. The server presents its own certificate, that certificate is signed by one or more intermediate certificates, and at the top sits a root certificate shipped by a certificate authority. If any link in that chain is missing, expired, or untrusted in the local store, Node.js raises an error such as unable_to_get_issuer_cert_locally or unable to get local issuer certificate, and Axios wraps it into AxiosError output.
Browsers ship with large root stores and often auto install missing intermediate certificates, so the same URL can look fine in Chrome while Axios fails in your Node.js script. Once you treat the message as a TLS trust problem and not just as an Axios bug, it becomes much easier to track down.
Common Situations Where This Axios Error Shows Up
Quick overview helps you spot patterns around this error instead of chasing random fixes. In most real projects the message appears in a few repeatable situations.
- Corporate proxy in the middle — Many office networks intercept HTTPS with a proxy that re signs traffic with a custom root certificate. Browsers trust that root because it is installed at the system level, while Node.js and Axios know nothing about it.
- Self signed or lab certificates — Test servers often run with a self signed certificate or with a chain issued by an internal certificate authority that is not in the default Node.js store.
- Old system trust store — On older Linux or Windows setups the ca bundle can miss new root or intermediate certificates, so a modern site that works on your laptop may fail on a build agent or container.
- Wrong host name or certificate mismatch — If the certificate common name or SAN does not match the host you call, validation fails and Axios complains about the local issuer.
- Custom httpsAgent misconfigurations — Code that sets its own ca values in an https.Agent can easily point at the wrong file, an empty bundle, or an outdated chain.
Once you group your case into one of these baskets, you can pick a fix that targets the real cause instead of flipping random flags in your Axios call.
Axioserror Unable To Get Local Issuer Certificate Fix Steps
Once you confirm that axioserror unable to get local issuer certificate comes from TLS validation and not from a simple typo, you can apply a fix that matches your case. Start with the option that keeps TLS checks in place, and leave any shortcut for last resort use only in local work.
Update Or Repair The System Trust Store
Start with the host that runs your Node.js code. If the problem is a missing public root or intermediate certificate, updating the platform trust store usually clears it. On many Linux distros you can run a package manager update for ca certificates, on macOS you can refresh trust settings in the certificate manager app, and on Windows you can install current root updates through system update tools.
After the update, restart the process that runs Axios and retry the call. If the error goes away on all hosts, you have fixed a system wide trust gap using a clean method that keeps certificate checks active.
Install A Custom Or Company Root Certificate
When a proxy or internal CA is in play, you often need to add that root certificate to the place where Node.js looks for trusted issuers. A common route is to export the company root in PEM format from the browser, save it to a file such as company-root.pem, and then point Node.js at it with the NODE_EXTRA_CA_CERTS variable value before you start your process.
You can also load the same PEM file in code by passing a ca field on the httpsAgent that you reuse with Axios. That way you keep using TLS validation, but you extend the trust chain so that the certificate issued by the proxy or internal authority no longer trips the local issuer check.
Pass The Right Certificate Chain To Axios
If you host the API, make sure your server sends a full chain that includes any needed intermediate certificates along with the leaf certificate. Web servers commonly expect you to bundle the server certificate and intermediates in one file. When the chain is complete, both browsers and Axios will see a clean path back to a trusted root and the issuer error disappears.
On the client side, projects that use mutual TLS often configure cert and ca fields in an https.Agent instance. Check that your ca bundle matches the server chain, does not include stale intermediates, and uses correct file paths. Simple typos in path strings cause more axioserror unable to get local issuer certificate messages than most people expect.
Avoid Disabling TLS Checks Except In Throwaway Tests
You will find many snippets that wrap Axios with https.Agent and set rejectUnauthorized to false. That disables TLS certificate validation and sidesteps the error. It also opens the door to man in the middle attacks and hides real certificate problems that will later block browsers or other clients.
If you ever set rejectUnauthorized to false, keep it only in short lived local experiments. Do not ship that change to shared servers, CI pipelines, or production code. Fixing the trust chain, even if it takes an extra step with certificates, keeps your API calls safe.
Working With Proxies And Company Setups
Many axioserror unable to get local issuer certificate reports come from proxy appliances or security gateways that re sign HTTPS traffic. These devices act as an HTTPS endpoint for your client and then start a second TLS connection toward the outside site. The client sees a certificate issued by an internal authority, not by the public authority listed on the website.
On developer laptops the desktop admin usually installs the proxy root in the OS trust store, so browsers treat the certificate as valid. A Node.js process that runs inside a container, a build agent, or a slim server image often ships its own trust store instead, which lacks that internal root. From the point of view of Axios the proxy looks like an unknown issuer, so the local issuer error appears.
Safe handling for this case follows a pattern.
- Export the proxy root — Use browser certificate tools or vendor instructions to export the proxy or company root certificate as a PEM file.
- Store it in a secure path — Place the PEM file in a directory that your Node.js process can read but that is not exposed to casual users.
- Wire it into Node.js — Set NODE_EXTRA_CA_CERTS to that PEM path or mount it into your container and load it through the ca option on an https.Agent instance shared with Axios.
- Test on and off the proxy network — Run the same Axios script on the office network and on a plain network to confirm that the only difference is the extra root certificate.
This path keeps TLS checks active, respects company security rules, and makes the axios error much less likely to appear again when new services are added behind the same proxy.
Quick Reference Table Of Causes And Fixes
Use this table as a compact reminder while you work through logs and certificate files.
| Cause | Typical Symptom | Main Fix |
|---|---|---|
| Missing public root or intermediate | Works in browser, fails in Axios on old host | Refresh system ca bundle or update OS trust store |
| Corporate proxy with custom root | Axios fails only on office network | Export proxy root and add it through NODE_EXTRA_CA_CERTS or httpsAgent ca |
| Self signed or lab certificate | Browser shows warning, Node.js refuses TLS | Install a trusted certificate or add the lab root in a controlled way |
| Broken server chain | Certificate viewer shows missing intermediate | Fix server config so it sends full chain with leaf and intermediate files |
| Bad httpsAgent settings | Error appears after refactor that added custom agent | Check ca paths, remove stale bundles, confirm you did not disable checks |
Hardening Your Setup After The Error Is Gone
Once the message stops appearing, take minutes to keep it from coming back and to keep your security posture steady. Cleaning up quick patches now saves debugging sessions when certificates rotate or hosts go live.
- Document your trust chain — Record which roots and intermediates each internal API uses and where the PEM files live so a teammate can repeat your setup without guesswork.
- Automate certificate renewals — Use tools that renew and reload server certificates so they never expire without alerts.
- Pin safe defaults in Axios — Share a single axios instance that always uses an https.Agent with sane ca settings instead of ad hoc flags per request.
- Watch for new proxy or security tools — When your company rolls out new gateways or scanners, expect TLS root changes and plan a short test run for your Node.js services.
Handled this way, axioserror unable to get local issuer certificate turns from a blocking surprise into a routine trust chain check again each time.
