Context
The API runs on Render's free plan (ADR-0026), which spins down when idle and takes ~50 s to boot. apiFetch had no timeout or retry, so the first sign-in after a quiet spell hung and then failed as if the credentials were wrong (architecture review, item 4).
Decision
- A GET/HEAD attempt has an
AbortControllertimeout (10 s, body included) inside a 25 s budget and at most one retry after a timeout, network error or proxy 502/503/504. - Every other method (login, register, refresh, ...) first runs
ensureApiAwake; a cold API is answeredwaking+notSentbefore anything is sent, since Render's edge would hold the POST and deliver it after we stopped waiting. It then gets a 30 s timeout and is retried only on a connect error. A refresh that left and got no answer stays memoised, never re-presented (ADR-0007). - Only
notSentfailures tell a form it may resubmit. The login form pollsGET /session/wake(one shared probe per instance, reused for 5 s) for up to 90 s, then submits once more. - A
/bff/*call has one 80 s server deadline (the post-rotation retry gets what is left, so the rotated cookies always reach the browser); the browser waits 90 s,/session/*60 s. - An external pinger hits
/health/liveevery few minutes. Thekeep-warm.ymlbackup that did the same from GitHub Actions was removed on 2026-10-28: the external pinger keeps the API warm on its own, and every scheduled run billed a minute of the 2,000 free.
Alternatives considered
- One long timeout (60 s) per call — holds a route handler for a minute and still fails silently.
- Retry every method — double-submits logins and spends refresh tokens twice, which revokes the chain.
- Paid always-on instance — no budget for it in the capstone.
Consequences
The first sign-in after idling is slow but succeeds. Mutating /bff/* calls are not auto-retried through a cold start; the client sees BffError.isWaking and retries on its own terms.