Let’s encrypt TLS setup for nodejs

Following my first test to setup a HTTPS server to dialogue with facebook API describe in my previous article here I had error when trying to register the facebook webhook:


I dig deeper and also verified the domain certificate with https://www.ssllabs.com/ssltest :


It seems good but there is a warning about the certificate chain… I done some quick research and it seem to be the root cause. After some investigation (and mainly thanks to this post) it seems the error comes from my nodejs server setup and more particularly the missing certificate authority certificate info. I miss it since it is not used in the official documentation. It is indeed an optional parameter

If this is omitted several well-known “root” CAs will be used, like VeriSign

Let’s add it in the options:

var options = {
    key: fs.readFileSync('/etc/letsencrypt/live/djynet.xyz/privkey.pem'),
    cert: fs.readFileSync('/etc/letsencrypt/live/djynet.xyz/cert.pem'),
    ca: fs.readFileSync('/etc/letsencrypt/live/djynet.xyz/chain.pem')

I done the ssl check another time and the error is now gone…. And the facebook webhook work fine too:


2 thoughts on “Let’s encrypt TLS setup for nodejs

  1. Pingback: HTTPS with let’s encrypt | Djynet

  2. Pingback: DNS challenge for let’s encrypt SSL certificates | Djynet

Comments are closed.