Nodejs Code:
var axios = require('axios');
var config = {
method: 'get',
url: 'http://localhost:8080/api/v2.0/admin/tenant/config/active',
headers: {
'Content-Type': 'application/json'
}
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
- "dependencies": { "@azure/identity": "^1.0.3", "@azure/keyvault-secrets": "^4.0.4", "@microsoft/recognizers-text-data-types-timex-expression": "1.1.4", "@types/node": "^14.0.24", "activedirectory": "^0.7.2", "agentkeepalive": "^4.2.1", "async-hooks-map": "^1.2.0", "axios": "^0.19.2", "body-parser": "^1.17.2", "botbuilder": "~4.9.0", "botbuilder-ai": "~4.9.0", "botbuilder-dialogs": "~4.9.0", "botbuilder-testing": "^4.10.0", "botframework-schema": "^4.10.0", "cors": "^2.8.4", "dotenv": "^8.2.0", "express": "^4.17.3", "express-session": "^1.16.1", "express-validator": "5.2.0", "log4js": "^4.5.1", "mongodb": "^3.6.0", "node-cache": "^5.1.2", "replace": "~1.2.0", "simple-ssh": "^1.0.0", "typed-rest-client": "1.0.7", "util": "^0.12.3" }, "devDependencies": { "@types/restify": "8.4.2", "nodemon": "^2.0.4", "tslint": "~6.1.2", "typescript": "~3.9.2" } }
Error:
Error: read ECONNRESET at TCP.onStreamRead (internal/stream_base_commons.js:209:20) { errno: -4077, code: 'ECONNRESET', syscall: 'read', config: { url: 'http://localhost:8080/api/v2.0/admin/tenant/config/active', method: 'get', headers: { Accept: 'application/json, text/plain, /', 'Content-Type': 'application/json', 'User-Agent': 'axios/0.19.2' }, transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, adapter: [Function: httpAdapter], xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, validateStatus: [Function: validateStatus], data: undefined },
Can anyone please tell me what can be the cause of this?


Your code is fine.
You should be able to surf to that URL with a web browser, because it's just a GET. That can help you to double-check it.
One thing that is rather strange, is the double slash in your path:
//. Postman is pretty intelligent, and perhaps postman just simplifies the request before sending it out.Anyway, I tested your code on one of my own webservers, and it works fine (for a different URL though).
Having said that, the ECONNRESET does indicate that there was a connection, but it was closed by the server unexepectedly. Why it was closed, is entirely up to the behavior of your webserver.