We’ve got an EventBridge rule listening to Genesys Cloud routing:conversation events, but we’re seeing duplicates hit our Lambda handler. Checked the EventBridge console, and the event ID is identical for the duplicates, so it’s definitely a GC-side retry or fan-out issue, not a network glitch.
Currently trying to handle this in the Lambda with a DynamoDB check:
def check_duplicate(event_id):
response = dynamodb.get_item(Key={'eventId': event_id})
if 'Item' in response:
return True
dynamodb.put_item(Item={'eventId': event_id, 'ts': time.time()})
return False
The problem is race conditions when the duplicates arrive within milliseconds of each other. The first write hasn’t committed before the second read happens. Also, DynamoDB costs are adding up with this volume.
Is there a better way? Should we be filtering at the EventBridge level with a content-based filter, or is there a specific header in the GC webhook payload that indicates a retry? The x-genesys-cloud-request-id looks promising, but the docs are vague on its uniqueness guarantees across retries.