Unable to verify the first certificate
<p>I have a directory containing a certificate bundle, a Python script and a Node script. Both scripts make a GET request to the same URL and are provided with the same certificate bundle. The Python script makes the request as expected however the node script throws this error:</p>

<blockquote>
  <p>{ [Error: unable to verify the first certificate] code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' }</p>
</blockquote>

<p>The Python script <em>(Python 3.4.3 and the <a href="https://github.com/kennethreitz/requests" rel="noreferrer">requests</a> library)</em>: </p>

<pre><code>import requests
print(requests.get(url, verify='/tmp/cert/cacert.pem'))
</code></pre>

<p>The node script <em>(Node 4.2.6 and the <a href="https://github.com/request/request" rel="noreferrer">request</a> library)</em>:</p>

<pre><code>var fs = require('fs');
var request = require('request');

request.get({
    url: url,
    agentOptions: {
        ca: fs.readFileSync('/tmp/cert/cacert.pem')
    }
}, function (error, response, body) {
    if (error) {
        console.log(error);
    } else {
        console.log(body);
    }
});
</code></pre>

<p>Both are using the same OpenSSL version:</p>

<pre><code>$ python -c 'import ssl; print(ssl.OPENSSL_VERSION)'
OpenSSL 1.0.2e-fips 3 Dec 2015

$ node -pe process.versions.openssl 
1.0.2e
</code></pre>

<p>I don't believe the problem to be with the certificate bundle and I don't want to turn off host verification in Node. </p>

<p>Does anybody know why Node is throwing this error?</p>