Sunday, 30 April 2017

Error while calling a HTTPS endpoint from a node server

I am getting an error while calling a HTTPS endpoint from a node server. The error is: unable to verify the first certificate with code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'. It is happening in TLSSocket. The API calling code is as follows:

request
.post(url)
.send(body)
.set('X-DreamFactory-Api-Key', process.env.APP_TOKEN)
.set('Accept', 'application/json')
.set('Content-Type', 'application/json; charset=utf-8')
.end(function(err, res) {
    console.log(err, res);
    if (err) {
        reject(err);
    } else {
        resolve(res.body);
    }
});

I am using superagent for the above call.

const request = require('superagent');



via vijayst

No comments:

Post a Comment