Skip to content

Fix Turbopack whole-project tracing from ffmpeg spawn calls - #2125

Merged
richiemcilroy merged 1 commit into
mainfrom
fix-ffmpeg-turbopack-tracing
Aug 14, 2026
Merged

Fix Turbopack whole-project tracing from ffmpeg spawn calls#2125
richiemcilroy merged 1 commit into
mainfrom
fix-ffmpeg-turbopack-tracing

Conversation

@richiemcilroy

@richiemcilroy richiemcilroy commented Aug 14, 2026

Copy link
Copy Markdown
Member

The dynamic ffmpeg path from getFfmpegPath() made Turbopack's output tracer fall back to tracing the entire project (including public/ and all CSS) into the serverless output for /api/tools/loom-download, /api/video/og, and the workflow step route.

This had two consequences:

  1. The build warnings pasted in the deploy log (5 spawn call sites plus a dynamic fs.readFile), and bloated serverless functions.
  2. The production deploy failure on main: the over-trace pulled app/globals.css and packages/ui/style/styles.css into the App Route module graph, where PostCSS evaluation failed with TypeError: __turbopack_context__.a is not a function and killed the build. The failing deploy's import trace shows globals.css reached via lib/video-convert.ts from the loom-download route, which is exactly this over-trace.

Fix: annotate all seven call sites (4 spawns in lib/audio-extract.ts, 1 spawn + 1 readFile in lib/video-convert.ts, 1 spawn in lib/og/poster-frame.ts) with turbopackIgnore. Safe because the ffmpeg binary still ships explicitly via serverExternalPackages + outputFileTracingIncludes in next.config.

Verified with a full local @cap/web build: tracing warnings went from seven to zero.

Greptile Summary

This PR adds Turbopack tracing-ignore annotations to dynamic ffmpeg spawn calls and a runtime temporary-file read, preventing whole-project serverless tracing while retaining explicit ffmpeg packaging.

  • Annotates four ffmpeg spawn sites in the audio extraction utilities.
  • Annotates the poster-frame and video-conversion ffmpeg spawn sites.
  • Excludes the runtime-created converted-video path from static output tracing.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or non-blocking defects identified in the changed code.

The annotations affect build-time output tracing only; runtime spawn arguments remain unchanged, the ignored file is always created dynamically in temporary storage, and explicit ffmpeg packaging remains configured.

Important Files Changed

Filename Overview
apps/web/lib/audio-extract.ts Adds tracing-ignore annotations to four existing dynamic ffmpeg spawn calls without changing their runtime arguments or process handling.
apps/web/lib/og/poster-frame.ts Excludes the dynamic ffmpeg executable from Turbopack tracing while preserving poster-frame extraction behavior.
apps/web/lib/video-convert.ts Excludes the dynamic ffmpeg executable and runtime-created temporary output path from static tracing without altering conversion or cleanup behavior.

Reviews (1): Last reviewed commit: "Fix Turbopack whole-project tracing from..." | Re-trigger Greptile

getFfmpegPath() returns a runtime-resolved binary path, so Turbopack's
output tracer could not scope the spawn() calls in audio-extract,
video-convert, and og/poster-frame (plus one dynamic fs.readFile of a
tmpdir path) and fell back to tracing the entire project into the
serverless output for /api/tools/loom-download, /api/video/og, and the
workflow step route.

Beyond bloating the functions with all source files and public/, the
over-trace pulled globals.css and @cap/ui styles.css into the App Route
module graph, where PostCSS evaluation failed with a Turbopack loader
TypeError and took down the production deploy.

Annotate all seven call sites with turbopackIgnore. The ffmpeg binary
itself still ships via serverExternalPackages and
outputFileTracingIncludes in next.config, which is why opting out of
tracing here is safe. Verified with a full @cap/web build: zero tracing
warnings, previously five plus two.
@cursor

cursor Bot commented Aug 14, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@richiemcilroy
richiemcilroy merged commit 9d07957 into main Aug 14, 2026
16 of 18 checks passed
@richiemcilroy
richiemcilroy deleted the fix-ffmpeg-turbopack-tracing branch August 14, 2026 10:36
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