Why do your webhook automations double-fire?
Your automation charged the customer twice, or sent the email twice, and the logs show nothing wrong. The problem is not a bug in your code. It is how webhooks work, and the fix is deduplication by event ID.
Webhooks are just HTTP calls
A webhook is a user-defined HTTP callback: when an event happens on one site, that site makes an HTTP request to a URL you configured. That is how Wikipedia defines it. Per the Stripe docs, Stripe pushes a JSON payload to your endpoint whenever something happens in your account, such as a payment succeeding. So your automation is really a public URL that anyone, or any retry, can POST to. You cannot assume one event means exactly one request.
- A webhook is an HTTP request to a URL you registered, nothing more
- One business event can produce more than one delivery
POST is not idempotent
The HTTP spec gives you no protection. MDN defines idempotency plainly: a method is idempotent if several identical requests have the same effect as one. GET, PUT and DELETE qualify. POST does not. And webhooks are POSTs. If the same delivery reaches your server twice, the HTTP spec gives you no protection. MDN also notes the spec does not mandate that servers honor these semantics. In practice, making your endpoint safe is on you, not the sender.
- Idempotent: repeat the request, the outcome stays the same
- Webhook deliveries use POST, which is not idempotent
Duplicate requests are normal
A trigger that fires on every request will fire twice for the same business event. MDN explains why repeats happen: a client may be unsure whether a request reached the server, and can safely retry when the method is idempotent. Webhook senders face the same uncertainty, but their deliveries are POSTs, which get no such safety. The Stripe docs also describe registering one endpoint for many event types at once. With repeated deliveries and several event types hitting one handler, a trigger that fires on every request will fire twice for the same business event.
- Uncertain delivery is why repeated identical requests exist, per MDN
- One handler serving many event types widens the blast radius
What this does not solve
Deduplication by event ID stops duplicate side effects. It does not make your automation correct, ordered, or fast. Do not treat deduplication as an architecture.
- Events can still arrive out of order or for cases you did not test
- The sources cover delivery semantics and idempotency only, not full event-driven design
Which of your webhook handlers would send a duplicate email or charge if the same payload and event id arrived twice right now?
Where would you store the event ID to make each handler safe, and who owns that decision?
Pick one live webhook handler and grep it for any event-ID check. Note what happens if the same payload is replayed.
Sources
Recommended for you
- Automation
Why do your retries keep doing the same job twice?
Networks fail, so your automation retries. Without idempotency, every retry risks a duplicate charge, ticket, or order, and the HTTP spec will not save you.
- Automation
What breaks when you automate everything in n8n?
Visual workflow tools promise speed, but every node you drag instead of code you write accrues a debt your team pays later.
- Automation
Why does your retry logic turn small failures into outages?
A service hiccups, every client retries at once, and the hiccup becomes a full outage. Retries are not free; they multiply demand on a system already struggling.
- Automation
Why do your unattended automations break at 2 AM?
Workflow automations fail overnight not because logic is wrong, but because nobody designed them to tolerate failure when no one is watching.
Enjoyed this article?
Subscribe for new articles. No spam. Unsubscribe anytime.