Story #19 Webhook Delivery · Event Deduplication

The Webhook That Delivered the Same Event Five Times

"Delivery is at-least-once. The integration assumed exactly-once—and provisioned the account twice"

ClearLedger's webhook consumer performed business actions before acknowledging receipt. When network disruption cut the connection mid-response, the sender retried. Without deduplication, the consumer processed the same activation event multiple times, triggering duplicate provisioning.

What happened

ClearLedger’s billing platform sent webhooks when subscription states changed. Each event included a stable event ID. The documentation stated delivery was asynchronous with automatic retries.

When a customer completed payment, ClearLedger sent a subscription.activated event. The customer’s service received it, committed the subscription update to its database, and began publishing an internal message. Before it could return HTTP 200, a regional network disruption cut the connection.

ClearLedger couldn’t know the event had been processed, so it retried. The receiver processed the same event again—triggering a second provisioning workflow and duplicate welcome notifications. A separate issue made diagnosis harder: two events for the same subscription arrived close together, and the later event was applied first. A delayed earlier event then overwrote part of the subscription state.

Root cause

The integration assumed exactly-once delivery. The receiver performed business actions before acknowledging receipt, creating a window where processing could succeed but the acknowledgement could be lost. No durable event deduplication existed. Happy-path tests covered one delivery and one HTTP 200, never duplicate delivery, delayed acknowledgement, or out-of-order events.

The fix

ClearLedger clarified its delivery guarantee: at-least-once, not exactly-once. The consumer was updated to validate webhook signatures, persist the event ID with a uniqueness constraint before triggering any business action, and return HTTP 200 immediately after recording the event. Business processing happens asynchronously with resource version checks to prevent older events from overwriting newer state.

Lesson learned

Webhook delivery is at-least-once by design. Any consumer that doesn’t deduplicate by event ID will eventually process the same event more than once. Test for duplicate delivery—it’s not a rare edge case, it’s an expected part of the protocol.

The Webhook That Delivered the Same Event Five Times