EventBridge deduplication logic failing on Genesys Cloud routing updates

We’ve got a Node.js service listening to Genesys Cloud events via EventBridge. The setup is standard: EventBridge captures the platform events, pushes to an SQS queue, and our consumer picks them up. The problem is we’re seeing duplicate events for the same interaction update, specifically when a conversation changes state from queued to wrapping. It seems like Genesys fires multiple updates in rapid succession, and EventBridge isn’t filtering them out before they hit our queue.

I tried adding a deduplication step in the consumer using a Redis cache with a TTL of 5 seconds. The logic checks if the data.id (the interaction ID) exists in the cache. If it does, skip processing. If not, process and add to cache. But it’s still letting duplicates through. Here’s the relevant snippet:

const redis = require('redis');
const client = redis.createClient();

async function handleEvent(event) {
 const interactionId = event.data.id;
 const exists = await client.exists(interactionId);
 
 if (exists) {
 console.log('Duplicate detected, skipping');
 return;
 }
 
 await client.set(interactionId, 'processed', 'EX', 5);
 await processInteraction(event);
}

The exists check returns false even when we know the event was just processed. I’m wondering if there’s a race condition or if the event IDs are slightly different between the duplicates. The JSON payload looks identical except for the timestamp in the eventTime field.

Is there a better way to handle this? Maybe using the eventTime as part of the deduplication key? Or is this a known issue with how Genesys Cloud publishes to EventBridge? I’ve checked the SDK docs but didn’t see anything about event ordering or deduplication guarantees. Anyone else run into this?