File tree Expand file tree Collapse file tree 3 files changed +13
-18
lines changed
Expand file tree Collapse file tree 3 files changed +13
-18
lines changed Original file line number Diff line number Diff line change 11import { put } from "@vercel/blob" ;
22import { addBundleToSandbox , createSandbox } from "@remotion/vercel" ;
3- import { ensureLocalBundle } from "./src/app/api/render/helpers" ;
3+ import { bundleRemotionProject } from "./src/app/api/render/helpers" ;
44
55const getSnapshotBlobKey = ( ) =>
66 `snapshot-cache/${ process . env . VERCEL_DEPLOYMENT_ID ?? "local" } .json` ;
@@ -13,7 +13,7 @@ const sandbox = await createSandbox({
1313} ) ;
1414
1515console . log ( "[create-snapshot] Adding Remotion bundle..." ) ;
16- ensureLocalBundle ( ".remotion" ) ;
16+ bundleRemotionProject ( ".remotion" ) ;
1717await addBundleToSandbox ( { sandbox, bundleDir : ".remotion" } ) ;
1818
1919console . log ( "[create-snapshot] Taking snapshot..." ) ;
Original file line number Diff line number Diff line change 11import { execSync } from "child_process" ;
2- import { existsSync } from "fs" ;
3- import path from "path" ;
42
5- export function ensureLocalBundle ( bundleDir : string ) : void {
6- const fullBundleDir = path . join ( process . cwd ( ) , bundleDir ) ;
7- if ( ! existsSync ( fullBundleDir ) ) {
8- try {
9- execSync ( `node_modules/.bin/remotion bundle --out-dir ./${ bundleDir } ` , {
10- cwd : process . cwd ( ) ,
11- stdio : "pipe" ,
12- } ) ;
13- } catch ( e ) {
14- const stderr = ( e as { stderr ?: Buffer } ) . stderr ?. toString ( ) ?? "" ;
15- throw new Error ( `Remotion bundle failed: ${ stderr } ` ) ;
16- }
3+ export function bundleRemotionProject ( bundleDir : string ) : void {
4+ try {
5+ execSync ( `node_modules/.bin/remotion bundle --out-dir ./${ bundleDir } ` , {
6+ cwd : process . cwd ( ) ,
7+ stdio : "inherit" ,
8+ } ) ;
9+ } catch ( e ) {
10+ const stderr = ( e as { stderr ?: Buffer } ) . stderr ?. toString ( ) ?? "" ;
11+ throw new Error ( `Remotion bundle failed: ${ stderr } ` ) ;
1712 }
1813}
1914
Original file line number Diff line number Diff line change 77import { waitUntil } from "@vercel/functions" ;
88import { COMP_NAME } from "../../../../types/constants" ;
99import { RenderRequest } from "../../../../types/schema" ;
10- import { ensureLocalBundle , formatSSE , type RenderProgress } from "./helpers" ;
10+ import { bundleRemotionProject , formatSSE , type RenderProgress } from "./helpers" ;
1111import { restoreSnapshot } from "./restore-snapshot" ;
1212
1313export async function POST ( req : Request ) {
@@ -46,7 +46,7 @@ export async function POST(req: Request) {
4646
4747 try {
4848 if ( ! process . env . VERCEL ) {
49- ensureLocalBundle ( ".remotion" ) ;
49+ bundleRemotionProject ( ".remotion" ) ;
5050 await addBundleToSandbox ( { sandbox, bundleDir : ".remotion" } ) ;
5151 }
5252
You can’t perform that action at this time.
0 commit comments