Symptom
Node.js jobs which are running with Job Scheduling service are connecting to SuccessFactors via destinations. While calling this service, the jobs occasionally return:
Error during request to remote service: ECONNRESET.
Environment
- Cloud Application Programming Model.
- Node.js
Cause
Remote service calls can occasionally fail due to various reasons.
Resolution
To increase resilience, a retry mechanism can be added to the remote service call. If the first call fails, it can be tried again (until a max retry count is reached). This is exemplified by the following snippet:
const resilientSend = async () => {
const maxRetries = 3
let _e
for (let i = 0; i < maxRetries; i++) {
try {
return await remoteSrv.send(/*...*/)
} catch (e) {
_e = e
}
}
throw _e
}
If the issue persists, the destination configuration has to be checked.
Keywords
Error during request to remote service, ECONNRESET, nodejs, CAPM. , KBA , BC-XS-CDX-NJS , SAP CAP – node.js runtime , Problem