Commerce applications / Case 03
Real scenario · client identity private
Quiet failure alerts for a custom Shopify checkout application
A custom application prepared discounted Shopify checkout links, but an error could leave the technical owner unaware until someone reported it. A separate notification path now reports detected failures, sends only a private email, and suppresses repeated alerts without holding up checkout.
Plain-English summary
What this solved for the business or user
The customer still uses the existing storefront and Shopify's secure payment flow. If checkout preparation fails, the normal error handling remains in control; sending a diagnostic notification is an independent, best-effort action. One incident should not produce an inbox full of identical messages.
Project snapshot
At a glance
| Purpose | Notify the technical owner of detected checkout failures |
|---|---|
| Alert path | Storefront and application error handlers → Cloudflare Worker → private email |
| Noise control | Shared 30-minute D1 cooldown; no success emails |
| Verification | Simulated delivery and authorization checked; real failure not intentionally triggered |
01 / Real situation
What was happening
The storefront used a Laravel application hosted separately from Shopify to validate promotion rules and create Draft Order checkout links. We needed a private signal when that handoff encountered an error, with no additional work on successful checkouts and no message sent for each customer retry.
02 / Constraint
Why the obvious solution was not enough
Calling the real checkout-creation endpoint as a synthetic availability check could create unwanted Shopify Draft Orders. A failed notification service also had to remain harmless to customers. And an error handler can only report failures it actually sees: if the entire application is unavailable before it can report, a separate external availability check is still needed.
03 / Implementation
How the solution works
- Keep the storefront's existing checkout-error handler and customer-facing failure state. Add lightweight, best-effort reporting on that error path instead of changing normal checkout behavior.
- Report relevant application-side failures from the Laravel service over an authenticated server-to-server channel. Keep its reporting secret on the server, never inside Shopify theme JavaScript.
- Dispatch notifications without awaiting delivery on the customer's checkout path. A timeout or email-provider problem must not create another checkout failure.
- Process reports in a separate Cloudflare Worker, validating the request before triggering delivery. Browser-originated signals and authenticated backend signals must not be mistaken for the same trust level.
- Use an atomic Cloudflare D1 reservation for a shared 30-minute cooldown. A burst of reports should produce one alert window, not one email per request or shopper.
- Forward an approved alert through a Google Apps Script email workflow to a single private technical inbox. Send only the minimum diagnostic context, not customer details, payment information, or cart contents.
- Check the report endpoint, unauthorized-request rejection, delivery to the intended inbox, and repeated-report suppression with controlled test signals. Inspect application reachability separately using GET-only requests.
04 / Release checks
What should be verified before shipping
- Confirm a successful checkout path does not send a failure notification.
- Confirm the backend report requires valid authentication and an unauthorized request is rejected.
- Send a controlled test report and verify delivery only to the intended private inbox.
- Send concurrent or repeated reports and verify the shared cooldown prevents duplicate emails.
- Check the storefront's existing error state and the application's response handling remain unchanged if reporting fails.
- Use GET-only service diagnostics instead of synthetic Draft Order creation.
- Before claiming complete coverage, test a controlled real checkout failure and add independent outage monitoring for cases when an error handler cannot report.
05 / Result
What changed
The Worker, D1 cooldown, and private email delivery were exercised with controlled reports. An unauthorized report was rejected, and the reporting route was verified without creating test Draft Orders. The theme integration and application service were also checked. A real end-to-end checkout failure was not deliberately triggered, so this is verified alert plumbing, not proof that every outage will be detected.
Reusable lessonAn alert should observe the transaction, not become a dependency of it. Report only meaningful failures, isolate notification infrastructure, centralize deduplication, and state exactly which failure modes still require independent monitoring.
Current note
How I would evaluate this today
Client identity and operational endpoints are deliberately omitted. This describes targeted error notifications, not an uptime SLA, full end-to-end checkout monitoring, or payment processing by the alert service.
