Repository navigation
Description
Summary
GlitchTip issues tale 109 (task TALE-405) and tale 373 (TALE-355), both titled BackendApiError: The platform is not answering right now — a deployment may be rolling; retry with …, are browser events. So is tale 371 (TALE-353), titled BackendApiError: The platform’s database is not answering right now — it may be restarting; retry w….
The SPA reports, at error level, every request that fails while the platform restarts:
- the edge's
UPSTREAM_UNAVAILABLE(502, 503 or 504), while a deployment rolls or the app tier restarts; - the platform's
503 DATABASE_UNAVAILABLE, while its database restarts.
The backend treats both as operational events and reports neither. The observability page says "A database restart is not reported as an error", and backend/db/unavailable.ts says "an operational event, not a defect … none of them reports an error". The browser, however, sends one event for each write that fails in that window, and one for each list read that reaches its error state, from every open tab. One restart therefore opens one error event per failed request.
Everything the person sees during such an outage is right (see below). Only the reporting is wrong.
Where the message comes from (main a703a9598)
- The sentence is the edge's, not the platform's. It exists in one place: the proxy's
handle_errors 502 503 504→@machineDoorrule, which answers it for/api/*,/eventsand the other machine doors when the upstream refuses, is marked down or times out (Caddyfile L409–L413). BackendApiErroris the browser's class.backendApiErrorFromBodyreads the flat{error, code}envelope: the sentence becomes the message,UPSTREAM_UNAVAILABLEthe code, and the status stays 502, 503 or 504 (api-client.ts L92–L120).- It reaches GlitchTip through the console.
- A failed write logs
console.error('Mutation failed: …', error)(use-backend-mutation.ts L77), and a failed action logs its twin. - A list in its error state logs
Error caught by boundary:throughuseErrorLogger. captureConsoleIntegration({ levels: ['error'] })turns each intocaptureException(error): loggerconsole, mechanismauto.core.capture_console(router.tsx L99–L113).
- A failed write logs
beforeSendkeeps it.prepareSentryEventdrops a cancelled request, an extension's error, a 4xx refusal and a transport failure. Since fix(platform): report browser defects, not extension or refusal noise #3513, every 5xx still reports (sentry-normalize.ts L209–L217).
The two identical titles land as separate GlitchTip issues (109 and 373) presumably because GlitchTip groups by title and location, and each call site gives the thrown error a different stack. That last point is an inference: the imported cards carry only the title.
Local reproduction (inert, synthetic, nothing production)
Setup:
- Edge: the repo's own
services/proxy/Caddyfile, rendered by its owndocker-entrypoint.sh, on Caddy 2.11.4 (the image's base iscaddy:2.11-alpine). Only file paths and the compose DNS names were rewritten to loopback. - App tier and database: the real backend and the Vite app of each revision, behind that edge, on an isolated PostgreSQL 16.
- Browser and errors: real Chromium.
SENTRY_DSNpointed at a local sink. - Data: a synthetic organization, project and tasks per round. Backend egress went to a dead proxy.
How the outages were staged:
- The edge's outage was a loopback relay standing in for
backend-api:3005that closes its listener, so the edge's dial is refused as it is mid-roll. - The database's was
pg_ctl -m fast, the image's SIGINT stop. - The control was the relay answering the backend's own text 500.
| Scenario | main a703a9598 |
with the fix |
|---|---|---|
Create task while the edge answers UPSTREAM_UNAVAILABLE |
One toast ("Something went wrong — try again…"), dialog open, title kept, no task created; Create succeeds once the edge answers again. 1 error event: BackendApiError: The platform is not answering right now — … (logger console). |
Same for the person. 0 events |
Open the projects list while the edge answers UPSTREAM_UNAVAILABLE |
projects/overview tried 4 times (1 s, 2 s, 4 s apart), then the table's error state with Try again, never an empty list. 1 error event (same title, through the boundary logger). |
Same. 0 events |
Cold page load while the edge answers UPSTREAM_UNAVAILABLE |
Skeleton until the edge answers, then the page, about 1 s later. 0 events. | Same |
Create task while the database restarts (DATABASE_UNAVAILABLE) |
One toast, dialog open, title kept; Create succeeds afterwards. 1 error event: BackendApiError: The platform’s database is not answering right now — … |
Same. 0 events |
| Control: the backend's own 500 | One toast, title kept. 1 error event BackendApiError: Request failed with status 500 |
Still 1 event |
In the database case the backend logged warnings only: 57P01 on the auth pool, pg-boss's one quiet line, /events backing off on 57P03, and the 503. The process stayed up and sent nothing.
Observation, not changed here: a list that reached its error state fills in by itself only when the /events stream reopens. That took 26–27 s after the edge answered again in a 21 s outage, because the reopen backs off exponentially, up to 60 s. Try again works at once.
Expected
These two answers are not reported from the browser either, consistent with the backend and the docs. The person still gets the toast or the list's error state. Every other 5xx keeps reporting: the backend's 500, a 502 the edge did not word, a dependency's 503 such as OBJECT_STORE_UNAVAILABLE, and either code at another status.
Related
- Backend side of the same restarts: TALE-406 / bug(platform): a backend that starts during a database restart reports an error and exits #4030 (the boot path), Bug: self-hosted demo05.tale.dev worker jobs and live API requests crash on deploy-window Postgres restarts (GlitchTip #1,2,3,5,6,7,9,10) #3273, fix(platform): answer a database restart with 503, not a crash or 500 #3506 and fix(platform): log pg-boss's failed polls once per database outage #3548.
- Browser filter this extends: fix(platform): report browser defects, not extension or refusal noise #3513 (Improvement: client Sentry lacks browser-extension filtering — one chrome-extension has minted 14 junk GlitchTip groups since May #3094).
- Out of scope: no edge, Ops or release change. The edge's sentence and statuses are unchanged.
Activity