Node.js Lambda hanging on GC Webhook payload parsing in .NET integration context

We’ve got an Azure Function (C#) that handles the heavy lifting for our CRM sync, but I’m trying to offload some initial validation to a Node.js 18 Lambda for cost savings. The goal is to catch conversation:updated webhooks from Genesys Cloud and do a quick check before triggering the .NET service.

The Lambda is deployed and reachable via API Gateway. When I send a test payload from Postman, it works. But when Genesys Cloud actually hits the endpoint, the Lambda logs show the event received, but the function hangs until timeout. No error returned to GC, just a 504 from API Gateway eventually.

Here’s the handler:

exports.handler = async (event, context) => {
 try {
 const body = JSON.parse(event.body);
 console.log('Received payload:', JSON.stringify(body));
 
 // Simple check if it's a conversation update
 if (body.eventType === 'conversation:updated') {
 console.log('Valid conversation update');
 return {
 statusCode: 200,
 body: 'OK'
 };
 } else {
 return {
 statusCode: 202,
 body: 'Ignored'
 };
 }
 } catch (error) {
 console.error('Error parsing webhook:', error);
 return {
 statusCode: 500,
 body: 'Internal Error'
 };
 }
};

The docs for the Webhook configuration say: “The payload is sent as POST with Content-Type: application/json.” But event.body is sometimes a stringified JSON and sometimes already parsed depending on the API Gateway integration type (Lambda Proxy vs. Custom).

I switched to event.body being a string, so JSON.parse should work. But the log shows Received payload: {"eventType": "conversation:updated", ...} correctly. Then it just stops. No error. No return.

Is there something specific about the GC webhook signature verification that’s blocking the execution? Or is Lambda context timing out because GC doesn’t get a 2xx fast enough? The .NET SDK handles retries, but this is a raw HTTP post.

Also, the event.headers['content-type'] is sometimes lowercase, sometimes uppercase. Should I be normalizing that?

Any ideas why it hangs after the console.log? It’s driving me crazy. The .NET side is fine, just this Node piece is flaky.