While you already set connectTimeout to 10 seconds, you might want to set both the socketTimeout (for read/write operations) and maxAttempts (for retries) explicitly.
export const KINESIS_CLIENT = new KinesisClient({ region: 'us-west-2', maxAttempts: 3, // Allows more retry attempts requestHandler: new NodeHttpHandler({ connectionTimeout: 20000, // 20 seconds connection timeout socketTimeout: 20000 // 20 seconds socket timeout }) });
Improved Error Handling
promises.push(processEvent(body).catch((err) => { console.error("Error processing record:", err); return err; // Capture error instead of failing immediately }));