Skip to content

fix: deduplicate remotion to fix useVideoConfig in production#232

Merged
ctate merged 1 commit intovercel-labs:mainfrom
vzt7:fix/remotion-duplicate-context
Mar 20, 2026
Merged

fix: deduplicate remotion to fix useVideoConfig in production#232
ctate merged 1 commit intovercel-labs:mainfrom
vzt7:fix/remotion-duplicate-context

Conversation

@vzt7
Copy link
Contributor

@vzt7 vzt7 commented Mar 20, 2026

Problem

The remotion example throws useVideoConfig() error in production:

image
Error stack trace
installHook.js:1 Error: No video config found. Likely reasons:
-- You are probably calling useVideoConfig() from outside the component passed to <Player />.
   See https://www.remotion.dev/docs/player/examples for how to set up the Player correctly.
-- You have multiple versions of Remotion installed which causes the React context to get lost.
    at pF (c6759ef9b85c6794.js?dpl=dpl_5DC7Zmn7mitSQtLShJiGVrtvuJuk:137:5041)
    at c6759ef9b85c6794.js?dpl=dpl_5DC7Zmn7mitSQtLShJiGVrtvuJuk:137:8209
    at av (5a0f99124522ad13.js?dpl=dpl_5DC7Zmn7mitSQtLShJiGVrtvuJuk:1:63271)
    at oV (5a0f99124522ad13.js?dpl=dpl_5DC7Zmn7mitSQtLShJiGVrtvuJuk:1:81291)
    at io (5a0f99124522ad13.js?dpl=dpl_5DC7Zmn7mitSQtLShJiGVrtvuJuk:1:98212)
    at sc (5a0f99124522ad13.js?dpl=dpl_5DC7Zmn7mitSQtLShJiGVrtvuJuk:1:137997)
    at 5a0f99124522ad13.js?dpl=dpl_5DC7Zmn7mitSQtLShJiGVrtvuJuk:1:137842
    at ss (5a0f99124522ad13.js?dpl=dpl_5DC7Zmn7mitSQtLShJiGVrtvuJuk:1:137850)
    at u9 (5a0f99124522ad13.js?dpl=dpl_5DC7Zmn7mitSQtLShJiGVrtvuJuk:1:133775)
    at sV (5a0f99124522ad13.js?dpl=dpl_5DC7Zmn7mitSQtLShJiGVrtvuJuk:1:159370)

Root Cause

pnpm creates two separate copies of remotion@4.0.418 because peer dependency versions differ between workspace packages:

Package Resolved remotion peer context
example-remotion react@19.2.3, react-dom@19.2.3
@json-render/remotion react@19.2.4, react-dom@19.2.4

Two remotion instances → two React.createContext() calls → <Player /> sets context in one copy, useVideoConfig() reads from the other → "No video config found".

Fix

Add turbopack.resolveAlias in next.config.js to force all remotion imports to resolve from the app's node_modules, ensuring a single instance.

Test plan

  • pnpm --filter example-remotion build succeeds with Turbopack
  • Verify video generation works in production deployment

pnpm creates separate copies of remotion@4.0.418 when peer dependency
versions differ between workspace packages (e.g. react@19.2.3 vs
react@19.2.4). This causes two React contexts, so useVideoConfig()
in @json-render/remotion cannot see the Player's context.

Add turbopack.resolveAlias to force all remotion imports to resolve
from the app's node_modules, ensuring a single instance.
@vercel
Copy link
Contributor

vercel bot commented Mar 20, 2026

@vzt7 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@ctate ctate merged commit b7993ed into vercel-labs:main Mar 20, 2026
3 of 16 checks passed
@ctate
Copy link
Collaborator

ctate commented Mar 20, 2026

Thank you so much for the fix @vzt7

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.

2 participants