NodeJS UNABLE_TO_VERIFY_LEAF_SIGNATURE

前端 未结 7 1493
鱼传尺愫
鱼传尺愫 2021-02-04 00:36

We\'re trying to use Node.js (and Mocha) as a testing framework to test API calls against an internal server over https. We\'re using the following node modules: Mocha, Restify

相关标签:
7条回答
  • 2021-02-04 01:09

    To resolve the issue, please install the module node_extra_ca_certs_mozilla_bundle using

    npm install --save node_extra_ca_certs_mozilla_bundle
    

    And then use it in you code with :

    const fs = require('fs');
    const https = require('https');
    https.globalAgent.options.ca = yourCertificatePEMcontent + fs.readFileSync('node_modules/node_extra_ca_certs_mozilla_bundle/ca_bundle/ca_intermediate_root_bundle.pem');
    

    This approach works for me.

    0 讨论(0)
提交回复
热议问题