Files
mercadodevida/work/artifacts/F-139/architect.md
2026-08-22 13:12:54 +02:00

15 lines
830 B
Markdown

# F-139 — Architect (bug fix)
## Bug
Admin `/admin/logs/stream` SSE connection drops with `ERR_NETWORK_IO_SUSPENDED`.
## Root causes
1. **Proxy** (`apps/admin/src/app/api/[...path]/route.ts`): did not set `X-Accel-Buffering: no`, which causes intermediate proxies (nginx) to buffer the SSE stream and kill it.
2. **Client** (`ServerLogViewer.tsx`): `connect()` goes to `reconnecting` status on drop but never actually reconnects — no retry loop.
3. **`LogBroadcaster.stream()`**: dead code — never used by the SSE route (uses `registerClient()` instead).
## Fixes
1. Proxy: add `X-Accel-Buffering: no` header; remove explicit `Connection: keep-alive` (default for HTTP/1.1).
2. Client: add exponential backoff reconnection loop (1s → 2s → 4s … max 30s).
3. Backend SSE endpoint already correct with proper headers.