Reputation: 13
I am trying to make a http post request to a remote server. It is successfully requested and get expected response in local development. However, after being promoted to DEV and UAT servers the same request posted an issue:
Encountered error in Axio request: read ECONNRESET
Here is the stack:
Error: read ECONNRESET
at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20)
at TLSWrap.callbackTrampoline (internal/async_hooks.js:131:17)
Here is the code:
async login(): Promise<string | undefined> {
try {
const result = await lastValueFrom(
this.httpService.post(
`${this.apiUrl}/login`,
{
email: this.configService.get('EMAIL'),
password: this.configService.get('PASSWORD'),
},
{
headers: {
'Content-Type': 'application/json',
},
},
),
);
this.logger.log(
`[login] result: ${result}`,
);
return result.data.token;
} catch (error) {
this.logger.error('can not login');
this.logger.error(error);
}
}
I asked network and security team to whitelist all the related URLs but the issue still persists. And I couldn't find any good sources to better explain and understand the issue. So I want to ask what can be the cause of this problem? Is it from my end or the web infrastructure end that can be the blocker here?
Upvotes: 0
Views: 358