-
Testing
Test how my app behaves when third-party APIs fail
Simulate timeouts, 500s, and malformed responses from external services so your app degrades instead of dying.
Free Prompt
My app depends on third-party APIs (payment provider, email service, maps, AI APIs, whatever I use) and I want to know what my app does when those services fail, because eventually they will.
First, list every external service my app calls and what user-facing thing depends on each one.
Then write tests that stub each service to fail in the realistic ways:
1. The service times out (slow response that never resolves within a sane window).
2. The service returns a 500 or 503.
3. The service returns a 200 with a malformed or unexpected body.
4. The service rejects my credentials (in case a key expires or gets rotated wrong).
For each failure, assert my app behaves acceptably: the user sees a useful error message (not a white screen or a raw API error dumped to the page), the failure gets logged somewhere I can find it, and no data ends up in a corrupt half-written state (for example, an order marked paid when the payment call actually failed).
Also check whether outbound calls have any timeout configured at all. A third-party call with no timeout can hang my server under load. Flag every call site without one.
When finished, run the suite and give me a per-service report: what fails gracefully and what takes my app down with it.
What This Does / How This Helps
This simulates third-party failures (timeouts, 500s, garbage responses, bad credentials) and verifies your app degrades gracefully instead of crashing or corrupting data. External APIs fail constantly: brief outages, slow responses during their incidents, breaking changes. An app that hangs on a timeout-free HTTP call or shows users a raw Stripe error looks broken even when the fault is someone else's. The half-written state case is the nasty one: an order that says paid when the charge never happened is a reconciliation nightmare that starts on day one.
Want to skip doing this by hand?
Fortivibe audits your app for all of the areas these prompts cover (and more).