Case File · INV-0052
Eight minutes of broken images, and every demo screenshot was a 504.
Rodrigo Lima was mid-demo with a prospect when every .webp on the page returned a broken icon. The CDN looked healthy. CauseFlow found the real ceiling: a Lambda cold start that consumed 3,098 ms of a 5,000 ms budget — leaving zero time for the image fetches.
The Lambda Budget Clock
Every image optimization request has a 5,000 ms budget. A cold start ate 3,098 ms of it before a single pixel was fetched.
Cold-Start Math
Three image fetches launched concurrently the moment the Lambda initialised — all three ran straight into the budget wall.
INIT_DURATION 3098 ms + fetch 2500 ms ≈ 5598 ms > 5000 ms budget → Timeout
CloudFront Hypothesis — Dismissed
The team's first instinct was CDN. CloudFront metrics showed no anomalies — cache hit rate normal, no origin errors reported. The problem was upstream of the CDN entirely.
CacheHitRate: 97.3% ← normalOriginLatency: n/a ← no origin errors logged5xxErrorRate: 0.00% ← CloudFront itself is healthyConclusion: problem is upstream of CDN.
Once a warm Lambda instance handled subsequent requests, the INIT_START overhead vanished — images served in 312 ms. Classic cold-start self-resolution.
Self-Healing Log Diff
INIT_START Runtime: nodejs:20.v37initDuration: 3098.74 msfetch dashboard-hero.webp → TimeoutErrorfetch test-flow-builder.webp → TimeoutErrorfetch results-panel.webp → TimeoutError→ Returning 504 to CloudFront
START RequestId: b2c3d4e5fetch dashboard-hero.webp → 200 (312 ms)fetch test-flow-builder.webp → 200 (289 ms)fetch results-panel.webp → 200 (301 ms)→ status: 200 billed: 847 ms
Three Paths Forward
CauseFlow surfaces options. Your team decides.
Provisioned Concurrency
Keeps one Lambda instance always warm. Eliminates cold starts during business hours. Cost: ~$15–20/month per warm instance.
Split Image Optimizer
Separate Lambda per image type reduces init payload and cold-start duration. More infrastructure to maintain.
Increase Timeout
Bumps the Lambda timeout to 10 s — buys breathing room on cold starts. Does not prevent them. Latency degrades for end users.
Root Cause
The WebsiteImageOptimizerFunction cold-started at 3,098 ms — 62% of the 5,000 ms total budget — leaving only 1,902 ms for three concurrent .webp fetches that each needed ~2,500 ms. All three timed out, CloudFront received 504, and the browser rendered broken images for the ~8 minutes it took for a warm instance to become available.
Stop hunting logs.
Start shipping product.
Connect your stack in minutes and investigate real incidents on your infra. No contract, no card.