To resolve the unable_to_get_issuer_cert_locally
error in Node.js, you can use the NODE_EXTRA_CA_CERTS
environment variable to specify additional CA certificates. Here’s how to configure it:
- Set Environment Variable: Export the path to your CA certificate file by running:
export NODE_EXTRA_CA_CERTS=/path/to/ca-cert.pem
Replace /path/to/ca-cert.pem
with the actual path to your CA certificate file.
-
Verify Certificate Chain: Ensure the CA certificate file includes the necessary certificates for validating the server’s certificate chain.
-
Restart Node.js Application: After setting the environment variable, restart your Node.js application to apply the changes.
This approach helps Node.js locate and use the additional CA certificates for SSL/TLS verification.To know more about this ‘UNABLE_TO_GET_ISSUER_CERT_LOCALLY’ error checkout this.