We’re migrating our webhook consumer from a monolith to an AWS Lambda in Node.js 18. The Genesys Cloud platform sends the event to an API Gateway endpoint, which triggers the function. The issue is that the payload for messaging:participant:modified events can get pretty large, and the Lambda times out before it finishes processing the JSON body.
Here’s the basic handler structure:
exports.handler = async (event) => {
const payload = JSON.parse(event.body);
// Logic to update user status in DynamoDB
await updateUserStatus(payload.conversationId, payload.participantId);
return {
statusCode: 200,
body: JSON.stringify({ message: 'processed' })
};
};
The timeout happens at the JSON.parse step or immediately after if the payload is >100KB. I’ve increased the Lambda timeout to 30 seconds, but it still hits the limit. Is there a specific way to handle chunked encoding or streaming the body in the API Gateway integration to avoid this parse bottleneck? Or is the GC webhook sending a format that Node’s default parser chokes on?
The error log just says Task timed out after 30.00 seconds. I’ve checked the CloudWatch logs and the incoming event.body string is definitely there, just huge.