I am using Express.js for my application and I get the error when making a post request to adobe analytics API.
I tried to add server.timeout
but it doesn't fix it...
This is the error message:
Error: read ECONNRESET
at exports._errnoException (util.js:1028:11)
at TLSWrap.onread (net.js:572:26) code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read'
This is the code that fails:
pullClassifications(req) {
const dfd = q.defer();
const { username, password, payload } = req;
const data = wsse({username: username, password: password});
const wsseHeaders = {'X-WSSE': data.toString({ nonceBase64: true })};
const options = {
'method': 'post',
'headers': wsseHeaders,
'content-type': 'application/json',
'body': payload,
'json': true,
'url': 'https://api.omniture.com/admin/1.4/rest/?method=ReportSuite.GetClassifications'
}
request(options, function(err, response, body) {
if(response.statusCode == 200) {
dfd.resolve(body);
} else {
dfd.reject({statusCode: response.statusCode, body: body});
}
})
return dfd.promise;
}
Update:
I tried to post the same request using Postman and it works, returning the response in 630000 ms.
What is the cause of this error and is there any way to fix it?