Why am I getting ECONNRESET errors when connecting to an endpoint?
When my Code Engine app, job, or function makes an HTTP request to an endpoint, my connection fails and an ECONNRESET
error is received.
An ECONNRESET
error can occur if keepalive settings in your HTTP client are not compatible with the settings on the destination server endpoint. How you configure your HTTP client depends on your programming language.
You can resolve this issue by configuring keepalive settings in the client.
For example, if you are using Node.js, you can use the agentkeepalive
module. Configure your HTTP client to use this module and then configure
the keepalive settings.
For example, the following code snippet illustrates one way that you can configure keepalive settings in your HTTP client.
[...]
import { HttpsAgent } from 'agentkeepalive';
const keepaliveAgent = new HttpsAgent({
maxSockets: 100,
maxFreeSockets: 10,
timeout: 60000,
freeSocketTimeout: 30000,
});
[...]
For more information, see example for keepalive settings.