Fix "unable to verify first certificate"
By Zennith Tech Lab
•
Published 2026-05-22
•
Node.jsSSLSecurityAPI
Verify security handshakes by injecting custom SSL certificates or adjusting environmental parameters in Node.
Custom CA Certificates Setup
Inject intermediate CA certificates into your environment parameters to resolve secure HTTPS handshakes in Node.js.
# Step 1: Load Root Cert Bundles
1. Rather than disabling SSL verification entirely (which poses extreme man-in-the-middle risks), install intermediate certificates in your script:
``javascript
// Configure Node to import verified root certificates
import ssl from 'ssl-root-cas';
ssl.create().inject();
`
2. Alternatively, set global parameters in development environments:
`bash
export NODE_EXTRA_CA_CERTS="/path/to/enterprise-ca.pem"
``