The webhook that fires twice
Halvard Freight's carrier webhook created two invoices for one delivery. Find the duplicate in the logs, explain why the carrier retried, and make the billing write safe to repeat.
- beginner
- about 25 min
- 4 objectives
- par 12 steps
- Halvard Freight
Read a webhook log and tell a retried delivery from a second event
Read the current task at the top of the console. Inspect evidence with the terminal or Files tab, then use the answer field to submit your findings. Tasks that ask for a fix check your file or service changes automatically.
No installation needed. The terminal runs supported commands and recorded programs in a simulated system. Need help? offers a starting point, then a clue or a worked example. Take time to investigate; the debrief includes a question about applying the lesson elsewhere. Your run is saved in this browser, and completed runs can be verified and saved to your account.
- Customer
- Halvard Freight (synthetic customer; every log and payload on this box is made up for the exercise)
- Situation
- Halvard's ops lead messaged at 08:50: three customers were invoiced twice for last night's deliveries. The integration you inherited last week receives
shipment.deliveredwebhooks from the carrier and posts an invoice to Halvard's billing service for each one. Nobody changed the code. The carrier says nothing is wrong on their side. - Your role
- You are the FDE on the Halvard engagement, working on the integration box
halvard-int-01. You may read anything, edit the receiver's config, and replay recorded webhook payloads. The billing service on this box is a simulator with the same contract as the real one. - Goal
- Name the event that was delivered twice, explain why the carrier retried, and change the integration so that replaying the same event never creates a second invoice. Prove it by replaying both recorded deliveries.
- 1.Identify the event that was delivered twice and answer with its event_id (you commit to an answer)
- 2.Explain why the carrier sent it twice (you commit to an answer)
- 3.Make the billing write idempotent on the identifier that survives a retry
- 4.Replay both recorded deliveries of the duplicated event and show that only one invoice is created, and let the live duplicates stop
