Most Shopify middleware works fine in staging. It breaks in production, during a sale, at 11pm on a Friday.
After auditing dozens of integrations, the failures are almost always the same. Not exotic bugs. Simple architecture decisions made when the system was small and never revisited.
The Pattern That Breaks Everything
Webhook received β Direct API call to ERP β ERP times out (3s) β Shopify retries β Duplicate event processed β Inventory corrupted β Weekend on-call incident
Enter fullscreen mode
Exit fullscreen mode
The fix is not a try-catch block. It is replacing the pattern entirely.
Rule 1: Acknowledge the webhook in under 200ms. Process it asynchronously.
Rule 2: Write state and outbox entries in one transaction.β¦