Interview Prep/Networking/TLS and certificate errors

Node.js app logs `Error: unable to verify the first certificate` calling an internal API.

IntermediateTroubleshootingTLS and certificate errors
Answer

Likely causes → The internal API serves a leaf without its intermediate, or is signed by a private CA Node doesn't know (Node ships its own CA list).

Diagnose →

openssl s_client -connect internal-api:443 -servername internal-api -showcerts </dev/null

Fix → Serve the full chain on the API, or start Node with NODE_EXTRA_CA_CERTS=/etc/ssl/private-ca.pem. Avoid NODE_TLS_REJECT_UNAUTHORIZED=0.

Prevent → Issue internal certs from a CA whose root is distributed to all images.

All Networking questions Roadmap: Networking for DevOps

More on TLS and certificate errors