Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node on heroku instance Error: unable to verify the first certificate

I'm trying to run an API served via heroku. Currently I'm using SSL from let's encrypt, and i've added it to the site via the domains and certificates panel in the settings page. While I'm able to connect to the site on my browser with https, as well as postman I'm unable to use a node.js instance to access the API, getting the following error:

{ Error: unable to verify the first certificate
   at TLSSocket.<anonymous> (_tls_wrap.js:1062:38)
   at emitNone (events.js:86:13)
   at TLSSocket.emit (events.js:185:7)
   at TLSSocket._finishInit (_tls_wrap.js:586:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:416:38) code: 
'UNABLE_TO_VERIFY_LEAF_SIGNATURE' }

I've tried using the ssl-root-cas module, but it doesn't seem to work on a heroku instance, as it needs to download intermeidate certificates and restart the server. However restarting the heroku instances causes the ssl-root-cas to simply lose the downloaded certificates. I was also unable to serve the SSL certificate directly from my node server. I need help fixing this issue, which I believe is a result of improperly bundling intermediate certificates.

like image 252
Tyler Harden Avatar asked May 03 '26 01:05

Tyler Harden


1 Answers

I found the best, easiest way to fix this is simply use the fullkey.pem when heroku asks for a cert.

like image 97
Tyler Harden Avatar answered May 04 '26 20:05

Tyler Harden