Email verification is often designed as a request-response feature: send a code, wait for the user, then mark the address as verified. In production, the email provider usually adds a webhook to that flow. That webhook can be retried, duplicated, delayed, or delivered out of order.
If the handler updates the user record directly every time, a late event can quietly undo a newer decision. The fix is not a bigger try/catch . It is a replay boundary: store each provider event, decide whether it is new, and apply only valid state transitions.
Why email webhooks need a replay boundary
Imagine a user requests two verification codes. The second code is current, but the provider delivers the first message's event after the second one. A naive Node.js handler may process both payloads and leave the account pointing at an expired challenge.
The same problem appears in test environments that use a free disposable email address or a fake inbox. The inbox is only the transport.…