Skip to main content

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.

4 min readHighLive demo abandonedFixed by CauseFlow in 1.5 min

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.

0 ms5000 ms budget
.webp #1.webp #2.webp #3
Cold start (INIT)Fetch window3× .webp fetch

Cold-Start Math

Three image fetches launched concurrently the moment the Lambda initialised — all three ran straight into the budget wall.

0 ms3098 ms5000 ms5598 ms5000 ms wallINIT 3098 ms#1INIT 3098 ms#2INIT 3098 ms#3

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.

CloudFront — no anomaly
CacheHitRate: 97.3% ← normal
OriginLatency: n/a ← no origin errors logged
5xxErrorRate: 0.00% ← CloudFront itself is healthy
Conclusion: 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

During incident — cold start
INIT_START Runtime: nodejs:20.v37
initDuration: 3098.74 ms
fetch dashboard-hero.webp → TimeoutError
fetch test-flow-builder.webp → TimeoutError
fetch results-panel.webp → TimeoutError
→ Returning 504 to CloudFront
After warm-up — healthy
START RequestId: b2c3d4e5
fetch 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.

Recommended

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.

Demo abandoned1 live prospect session lost

Stop hunting logs.
Start shipping product.

Connect your stack in minutes and investigate real incidents on your infra. No contract, no card.