Menu

Webhook signature failures for 11 minutes, twice a day: it was the clock
📰

Webhook signature failures for 11 minutes, twice a day: it was the clock

DEV Community: backend·Payneteasy·1 day ago
#nCairfoI
#devtobackend#devto#dev#minutes#event
Reading 0:00
15s threshold

A merchant's webhooks failed signature checks for about 11 minutes, twice a day. The HMAC secret hadn't changed.

The handler rejected any event whose timestamp differed from now by more than 5 minutes, a standard replay guard. The cause was the host clock. The VM paused during live migration and resumed roughly 6 minutes behind until chrony stepped it back. Every webhook in that window looked like it came from the future and got a 400.

Some retries landed after the clock was corrected and passed. Others used up their retry budget, and those orders stayed pending until the nightly reconciliation caught them.

What we changed:

Log the computed skew on every rejection. The old line said only "invalid signature", so the pattern took a day to spot.

Widen tolerance to 10 minutes. Replay is already covered by deduplicating on event ID.

Alert when skew on accepted webhooks passes 60 seconds. It fires before rejections start.

Return 503, not 400, for timestamp failures.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.