Example run Brindle Coffee › Runs › Run #3
Prove invoice.paid · renewal
Stripe · From sub_1QH…4drI · #01 #03 #04 · localhost:3000/webhooks/stripe
Run by maya-mbp from the web app
A real run against a deliberately buggy handler. Get a URL to prove your own.
3 findings
Critical 1 High 1 Medium 1 Info 1
exit 1State after D5 · orders.count
1 to 2
Expected 1 · got 2
Same request, same response, a different state.
Findings
What happened
D12 changed amount_paid from 2400 to 0 and was signed for the original body. Your handler returned 200 in 167 ms and created an order: orders.count 0 → 1, expected a 4xx and no change.
Why it matters
Stripe signs the exact bytes it sends. If a failed check doesn't stop the request, anyone who can reach this URL can create paid orders.
Stripe docs › Webhooks › Verify signatures
Likely cause: Late (D9) was rejected, so the timestamp check runs; the signature check probably fails into a log line instead of stopping the request.
Fix
Return 400 as soon as constructEvent throws, before any write. After the fix, D12 should get 400 and leave orders.count at 0.
Express (detected from X-Powered-By)
app.post('/webhooks/stripe', express.raw({ type: 'application/json' }), (req, res) => { let event; try { event = stripe.webhooks.constructEvent(req.body, req.get('stripe-signature'), endpointSecret); } catch (err) { return res.status(400).send('Invalid signature'); // stop here, don't log and continue } // ...handle event });Same request, same response, a different state.
What happened
D5 delivered the same invoice.paid event as D4. Both got 200 {"received":true}, but orders.count went 1 → 2, expected 1. The retry D11 did the same after D10. Only the probe could see this.
Why it matters
Stripe may deliver the same event more than once, and retries failed or timed-out deliveries with backoff for up to 3 days in live mode. Each duplicate creates another order.
Stripe docs › Webhooks › Handle duplicate events · Retry behavior
Likely cause: The handler doesn't record the event id before it writes.
Fix
Record event.id before creating the order and return 200 early when it is already recorded. After the fix, D5 and D11 should leave orders.count at 1.
Express (detected from X-Powered-By)
// before creating the order const { rowCount } = await db.query( 'INSERT INTO processed_events (id) VALUES ($1) ON CONFLICT DO NOTHING', [event.id] ); if (rowCount === 0) return res.sendStatus(200); // already handledWhat happened
2 of 8 valid invoice.paid deliveries took longer than the 10 s budget (Webhook Trap default): D10 (11 840 ms) and D16 (10 420 ms). Stripe doesn't publish its timeout, so these are over our default budget, not proven failures at Stripe.
Why it matters
If Stripe times out waiting, the delivery counts as failed and is retried. Stripe doesn't publish the timeout. In this run, D10 went over our default budget, and the retry D11 created the duplicate order in F2.
Stripe docs › Webhooks › Quickly return a 2xx response
Likely cause: Only some deliveries of invoice.paid were slow, so the slow step is intermittent: usually an external call or a lock wait before the response.
Fix
Acknowledge with 200 first, then queue the slow work. After the fix, D10 and D16 should respond within the budget.
Express (detected from X-Powered-By)
res.sendStatus(200); // acknowledge first await queue.add('create-label', { invoiceId: event.data.object.id });What happened
Shuffled and Burst passed on orders.count. But customer.subscription.updated was delivered first in Shuffled (D6) and inside the burst (D15), and no probe reads subscription state.
Why it matters
Out-of-order delivery usually breaks status fields, not counts.
Stripe docs › Webhooks › Event ordering
Fix
Add subscriptions.status to the probe in webhooktrap.yml. The next run then checks both.
webhooktrap.yml
probe: # keep your existing entries, then add: - as: subscriptions.status sql: select status from subscriptions where stripe_id = '{{subscription.id}}'
Inspector · D5 · Twice · invoice.paid
CloseRequest
POST http://localhost:3000/webhooks/stripe
sent +4 720 ms · re-signed (same event id) · 2 294 B
| Content-Type | application/json; charset=utf-8 |
|---|---|
| User-Agent | Stripe/1.0 (+https://stripe.com/docs/webhooks) |
| Stripe-Signature | signed on maya-mbp · value not stored |
| Webhooktrap-Run | run_01M75F1M56RSH0CVKCTFX4FQWC |
| Webhooktrap-Delivery | D5 |
| Webhooktrap-Scenario | twice |
| Webhooktrap-Dry-Run | 1 |
Body: Exact bytes of capture #01
Response
200 · 196 ms
196 ms of the 10 s budget · Webhook Trap default
| Content-Type | application/json; charset=utf-8 |
|---|---|
| X-Powered-By | Express |
| Content-Length | 17 |
{"received":true}Deliveries
| D | +ms | Event | Status | Latency (10 s budget) | orders.count | Result |
|---|---|---|---|---|---|---|
| Once · 200 × 3 · orders.count 0 → 1 | ||||||
| D1 | +1 320 | invoice.paid | 200 | 184 ms | 0 → 1 | ▬ pass |
| D2 | +1 684 | payment_intent.succeeded | 200 | 121 ms | 1 → 1 | ▬ pass |
| D3 | +1 985 | customer.subscription.updated | 200 | 143 ms | 1 → 1 | ▬ pass |
| Twice · 200, 200 · orders.count 1 → 2 on D5, expected 1 | ||||||
| D4 | +3 978 | invoice.paid | 200 | 212 ms | 0 → 1 | ▬ pass |
| D5 | +4 720 | invoice.paid= D4′ | 200 | 196 ms | 1 → 2 · expected 1 | High · F2 |
| Shuffled · reversed · orders.count 0 → 1 · status not probed | ||||||
| D6 | +6 766 | customer.subscription.updated | 200 | 138 ms | 0 → 0 | ▬ pass |
| D7 | +7 084 | payment_intent.succeeded | 200 | 117 ms | 0 → 0 | ▬ pass |
| D8 | +7 381 | invoice.paid | 200 | 199 ms | 0 → 1 | ▬ pass |
| Late · 400 in 41 ms · rejected as expected | ||||||
| D9 | +9 430 | invoice.paidt − 360 s | 400 | 41 ms | 0 → 0 | ▬ pass (rejected) |
| Retry after error · D10 11 840 ms → retry D11 → orders.count 1 → 2 | ||||||
| D10 | +11 321 | invoice.paid | 200 | 11 840 ms +1 840 over | 0 → 1 | Medium · F3 |
| D11 | +25 191 | invoice.paidretry | 200 | 205 ms | 1 → 2 · expected 1 | High · F2 |
| Tampered · 200 in 167 ms · accepted a changed body | ||||||
| D12 | +27 246 | invoice.paidbody changed | 200 | 167 ms | 0 → 1 · expected 0 | Critical · F1 |
| Burst · 200 × 3 · 312–601 ms · orders.count 0 → 1 (final) | ||||||
| D13 | +29 263 | invoice.paid | 200 | 601 ms | — | ▬ pass |
| D14 | +29 265 | payment_intent.succeeded | 200 | 312 ms | — | ▬ pass |
| D15 | +29 266 | customer.subscription.updated | 200 | 448 ms | — | ▬ pass |
| Slow budget · 10 420 ms · 420 ms over budget | ||||||
| D16 | +31 714 | invoice.paid | 200 | 10 420 ms +420 over | 0 → 1 | Medium · F3 |