We’re piping CXone interaction events (specifically interaction:created and routing:conversation:updated) into AWS EventBridge, which triggers a Node.js Lambda. The volume spikes during peak shifts, and we’re hitting the Lambda concurrency limit. The events pile up in the queue, and by the time Lambda scales up, the downstream database writes are failing with timeout errors because the payload is stale or the DB connection pool is exhausted.
I’ve tried increasing the reserved concurrency, but the cost is prohibitive, and it doesn’t solve the burst issue. The Lambda function processes the event, enriches it with customer data from our internal API, and writes to DynamoDB. It’s a simple flow, but the sheer number of events per second breaks it.
Here’s the basic handler structure:
exports.handler = async (event) => {
const records = event.detail;
// Process each record
for (const record of records) {
await enrichAndStore(record);
}
return { statusCode: 200 };
};
I’m considering batching the writes or using Step Functions to fan out, but I want to avoid the overhead if possible. Is there a way to configure EventBridge to buffer events before sending them to Lambda? Or should I be using SQS as a buffer between EventBridge and Lambda to control the batch size and retry logic?
Current setup:
- CXone EventBridge rule sends to AWS EventBridge bus
- EventBridge rule triggers Lambda
- Lambda Node.js 18.x
- DynamoDB as storage
- Average 500 events/sec, peaks at 2000/sec
The error logs show Task timed out after 30.00 seconds when the concurrency limit is hit. I need a pattern that handles the burst without blowing up the bill or losing events.