API Testing error Error: timeout of 5000ms exceeded
The HTTP client gave up waiting for a response before the server replied, which could be a slow endpoint, a slow test environment, or a hung request.
Why this happens
- The endpoint is genuinely slow under the test environment's load (e.g. cold serverless function, small test DB instance)
- A previous test left the system in a state that makes this request unusually expensive (large dataset, N+1 query)
- The test's configured client timeout is simply shorter than the endpoint's real p95 latency
How to fix it
- Check whether the timeout is consistent (a real perf problem) or intermittent (an environment/data problem) before touching the timeout value
- Only raise the client timeout once you've confirmed the endpoint is expected to be this slow
- Isolate test data per test so one test's data volume doesn't slow down another's requests