Search code examples
node.jssslphantomjshtml-pdf

SSL Error when using html-pdf in a Render instance


I'm using the html-pdf library to generate PDF files from HTML, and it's working great on my machine. However, when attempting to use this on an instance of the project hosted on Render, I'm getting the following error:

Auto configuration failed
140113131916928:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object file: No such file or directory
140113131916928:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:
140113131916928:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf
140113131916928:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf

The root of this issue seems to be the SSL configuration, supported by this github issue -- the answer to this issue seems to have solved the problem on their machine, but I'm not sure how to configure SSL in this way for my Render instance. I'm also not sure if it's possible, or if it would solve the problem. Any insight into this issue would be super helpful!


Solution

  • I had same problem, The problem is openssl.cnf file.

    Use this code:

    pdf.create(html, {
      childProcessOptions: {
        env: {
          OPENSSL_CONF: '/dev/null',
        },
      }
    });