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. Let a worker handle external calls. Rule 3: Tag every event with an idempotency key before it touches anything.…