Fix Turbopack whole-project tracing from ffmpeg spawn calls - #2125
Merged
Conversation
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.
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
TypeError: __turbopack_context__.a is not a functionand 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.
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
Reviews (1): Last reviewed commit: "Fix Turbopack whole-project tracing from..." | Re-trigger Greptile