Error Diagnostics // NodeFlow Diagnostics
504 Gateway Timeout on Multi-Agent RAG Chains
Multi-agent Supervisor, Tool Agent, and Reranker chains often take 70-180 seconds end-to-end—exceeding Nginx 60s and Cloudflare 100s synchronous HTTP limits.
Measured Stack Telemetry & Memory Profile
When Flowise runs in single-process MODE=main, a slow tool call or large vector upsert holds the HTTP socket open until the reverse proxy drops it with HTTP 504. Moving execution to Redis BullMQ workers or asynchronous Make.com webhook callbacks decouples HTTP acknowledgment from LLM latency.
| Subsystem / Signal | Measured Target | Operational Impact |
|---|---|---|
| Default Nginx proxy_read_timeout | 60 seconds | Drops multi-step agent runs mid-reasoning |
| Cloudflare Proxy Timeout | 100 seconds | Hard 524/504 edge cutoff on non-streamed JSON |
| Queue + Async Webhook Ack | < 180 ms HTTP 202 | Eliminates 504 timeouts across 20-60 flows |
Step-by-Step Triage & Config Remediation
- Enable SSE token streaming: Stream responses via Server-Sent Events so proxy idle timers reset on every generated token.
- Switch Flowise to MODE=queue: Offload long agent predictions and document upserts to dedicated Redis + flowise-worker containers.
- Use Make.com async callback webhooks: Trigger long multi-agent runs from Make.com (10,000 free ops 1st mo) and receive results via callback URL.
proxy_read_timeout 300s; proxy_send_timeout 300s; proxy_buffering off; # Plus Flowise .env: MODE=queue
Diagnostic FAQ
Does raising Nginx proxy_read_timeout to 300s fix Cloudflare 524?
No. Cloudflare proxies still enforce a ~100s timeout on non-streaming HTTP responses; you must stream tokens or decouple via queue/webhooks.
Why does Make.com help prevent 504 timeouts?
Make.com receives the webhook immediately, throttles concurrent agent calls, and waits cleanly or handles retries outside the browser request.