I am using Axios in node.js and it is throwing exception while calling get http request in one of our project setup environment BUT same code works fine in my laptop. Do I need to explicitly set http_proxy in while calling axios , I am not sure, please help me in understanding the issue.
Below is my code:
async function executeGetOperation(url, endPoint) {
let result;
const headers = {
'x-functions-key': endPoint.FunctionKey,
'Cache-Control': 'no-cache',
'Pragma': 'no-cache'
};
await axios.get(url, {
headers: headers
})
.then((response) => {
result = response.data;
})
.catch((err) => {
result = null;
console.error(err);
})
return result;
}
Exception:
{
"message": "read ECONNRESET",
"name": "Error",
"stack": "Error: read ECONNRESET\n at TLSWrap.onStreamRead (node:internal/stream_base_commons:220:20)",
"config": {
"transitional": {
"silentJSONParsing": true,
"forcedJSONParsing": true,
"clarifyTimeoutError": false
},
"transformRequest": [
null
],
"transformResponse": [
null
],
"timeout": 0,
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
"maxContentLength": -1,
"maxBodyLength": -1,
"env": {},
"headers": {
"Accept": "application/json, text/plain, */*",
"x-functions-key": "****",
"Cache-Control": "no-cache",
"Pragma": "no-cache",
"User-Agent": "axios/0.27.2",
"host": "***"
},
"method": "get",
"url": "*******"
},
"code": "ECONNRESET",
"status": null
}