Skip to content

@remotion/serverless-client: Fix cost estimate increasing after fatal error#6959

Merged
JonnyBurger merged 1 commit intomainfrom
fix/lambda-cost-after-fatal-error
Apr 1, 2026
Merged

@remotion/serverless-client: Fix cost estimate increasing after fatal error#6959
JonnyBurger merged 1 commit intomainfrom
fix/lambda-cost-after-fatal-error

Conversation

@JonnyBurger
Copy link
Copy Markdown
Member

Summary

  • When a Lambda render hits a fatal error, the cost estimate returned by getRenderProgress() kept increasing on every call, even though no Lambda functions were running
  • Root cause: unfinished chunks used Date.now() to estimate their duration, so the cost grew linearly with wall-clock time
  • Fix: store a fatalErrorTimestamp when a fatal error is recorded and use it to cap the elapsed time calculation

Test plan

  • Existing price-calculation.test.ts passes
  • bun run build succeeds
  • Trigger a Lambda render with a fatal error and verify getRenderProgress() returns stable cost values after the error

🤖 Generated with Claude Code

…al error

When a render encountered a fatal error, the cost estimation for
unfinished chunks used Date.now() on every getRenderProgress call,
causing costs to grow indefinitely even with no lambdas running.

Store a fatalErrorTimestamp when a fatal error is recorded and use it
to cap the elapsed time calculation for unfinished chunks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pullfrog
Copy link
Copy Markdown
Contributor

pullfrog bot commented Apr 1, 2026

Reviewed PR #6959 — no actionable issues found. The fix correctly caps the cost estimate at the time of the first fatal error by threading a fatalErrorTimestamp through the price estimation pipeline.

Task list (4/4 completed)
  • Read diff and understand the change
  • Trace data flow through changed files
  • Check for missing callsites or stale references
  • Draft and submit review

Pullfrog  | View workflow run | Triggered by Pullfrog | Using Big Pickle (free) | 𝕏

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bugs Ready Ready Preview, Comment Apr 1, 2026 10:23am
remotion Ready Ready Preview, Comment Apr 1, 2026 10:23am

Request Review

Copy link
Copy Markdown
Contributor

@pullfrog pullfrog bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean fix. The fatalErrorTimestamp is recorded exactly once on the first fatal error, threaded correctly through to estimatePriceFromMetadata, and the ?? null fallback in progress.ts handles backward compatibility with serialized data from before this change. All callsites updated, no issues found.

Pullfrog  | View workflow run | Using Big Pickle (free) | 𝕏

@JonnyBurger JonnyBurger merged commit ea87825 into main Apr 1, 2026
19 checks passed
@JonnyBurger JonnyBurger deleted the fix/lambda-cost-after-fatal-error branch April 1, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant