Deduplicating Genesys Cloud EventBridge events in Node.js consumer

We’re seeing duplicate events hitting our AWS Lambda consumer from the Genesys Cloud EventBridge integration. It’s causing our New Relic custom event ingestion to spike and skewing our analytics.

The setup is straightforward: GC sends to EventBridge, which triggers a Node.js Lambda. We’re using the @aws-sdk/client-lambda to handle the logic, but the deduplication isn’t holding up.

Here’s the relevant snippet from our handler:

const { v4: uuidv4 } = require('uuid');

exports.handler = async (event) => {
 for (const record of event.Records) {
 const detail = JSON.parse(record.body);
 const eventId = detail.sourceEventId;
 
 // Attempting to dedupe via DynamoDB
 const dedupeKey = `gc_event_${eventId}`;
 
 // Logic to check if key exists...
 // If not, process and write to NR
 }
};

The issue is that detail.sourceEventId seems to be unique per webhook push, but EventBridge is resending the same GC event within the same batch or across retries. We’re getting 2-3 duplicates per actual conversation update.

Environment specs:

  • GC EventBridge integration configured for routing.queueEvent
  • AWS Lambda (Node.js 18)
  • DynamoDB for deduplication state (TTL 24h)
  • New Relic Node.js agent for APM

We’ve tried:

  • Using event.id from EventBridge as the key, but that changes on retry.
  • Checking detail.timestamp, but GC sends the same timestamp for duplicates.
  • Adding a processed flag in DynamoDB, but race conditions are causing misses.

Is there a standard pattern for this? Or is the GC EventBridge source emitting these duplicates inherently? We need a reliable way to ignore the second and third hits without dropping legitimate retries.