🎥 Make videos programmatically with React
apply more
Jonny Burger7bc338c45e91
diff --git a/packages/template-vercel/src/app/api/render/sandbox/install-js-dependencies.ts b/packages/template-vercel/src/app/api/render/sandbox/install-js-dependencies.tsindex aada5271be..d7a0d66918 100644--- a/packages/template-vercel/src/app/api/render/sandbox/install-js-dependencies.ts+++ b/packages/template-vercel/src/app/api/render/sandbox/install-js-dependencies.ts@@ -17,9 +17,8 @@ export async function installJsDependencies({detached: true,});- // eslint-disable-next-line @typescript-eslint/no-unused-varsfor await (const _log of installCmd.logs()) {- // Consume logs without displaying+ console.log(_log.data);}const installResult = await installCmd.wait();diff --git a/packages/template-vercel/src/app/api/render/sandbox/patch-compositor.ts b/packages/template-vercel/src/app/api/render/sandbox/patch-compositor.tsindex b4d9f90cb3..9093e5aa19 100644--- a/packages/template-vercel/src/app/api/render/sandbox/patch-compositor.ts+++ b/packages/template-vercel/src/app/api/render/sandbox/patch-compositor.ts@@ -1,8 +1,8 @@import { Sandbox } from "@vercel/sandbox";-const GLIBC_DIR = "/opt/glibc235";+const GLIBC_DIR = "/tmp/glibc235";const LIBC6_DEB_URL =- "http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/libc6_2.35-0ubuntu3.9_amd64.deb";+ "http://launchpadlibrarian.net/612471225/libc6_2.35-0ubuntu3.1_amd64.deb";/*** Patches the Remotion compositor binary to use a bundled glibc 2.35.@@ -22,27 +22,50 @@ export async function patchCompositor({const script = `set -euo pipefail+echo "[patch-compositor] Listing node_modules/@remotion/:"+ls -la node_modules/@remotion/ 2>&1 || echo "(directory does not exist)"++echo "[patch-compositor] Checking .pnpm store for compositor packages:"+ls -la node_modules/.pnpm/@remotion+compositor-linux* 2>&1 || echo "(none found in .pnpm)"++echo "[patch-compositor] Checking for compositor directories..."+for dir in node_modules/@remotion/compositor-linux-x64-gnu node_modules/@remotion/compositor-linux-x64-musl; do+ if [ -e "$dir" ]; then+ echo "[patch-compositor] Found: $dir ($(stat -c '%F' "$dir" 2>/dev/null || file "$dir"))"+ if [ -L "$dir" ]; then+ echo "[patch-compositor] Symlink target: $(readlink -f "$dir")"+ fi+ echo "[patch-compositor] Contents:"+ find -L "$dir" -type f 2>&1 || true+ else+ echo "[patch-compositor] Not found: $dir"+ fi+done+COMPOSITOR_BIN=""+# Search with -L to follow pnpm symlinksfor dir in node_modules/@remotion/compositor-linux-x64-gnu node_modules/@remotion/compositor-linux-x64-musl; do- if [ -d "$dir" ]; then- COMPOSITOR_BIN="$(find "$dir" -name remotion -type f | head -1)"+ if [ -e "$dir" ]; then+ COMPOSITOR_BIN="$(find -L "$dir" -name remotion -type f | head -1)"[ -n "$COMPOSITOR_BIN" ] && breakfidone+# Fallback: search the pnpm store directlyif [ -z "$COMPOSITOR_BIN" ]; then- echo "Compositor binary not found, skipping patch"- exit 0+ echo "[patch-compositor] Trying pnpm store fallback..."+ COMPOSITOR_BIN="$(find -L node_modules/.pnpm -path '*compositor-linux-x64*' -name remotion -type f 2>/dev/null | head -1)"fi-# Check if patch is needed by looking at the required glibc version-NEEDS_PATCH=$(readelf -V "$COMPOSITOR_BIN" 2>/dev/null | grep -c "GLIBC_2\\.3[5-9]\\|GLIBC_2\\.[4-9]" || true)-if [ "$NEEDS_PATCH" = "0" ]; then- echo "Compositor does not require glibc > 2.34, skipping patch"- exit 0+if [ -z "$COMPOSITOR_BIN" ]; then+ echo "[patch-compositor] ERROR: Compositor binary not found"+ exit 1fi+echo "[patch-compositor] Found compositor binary: $COMPOSITOR_BIN"+# Download and extract glibc 2.35 from Ubuntu 22.04+echo "[patch-compositor] Downloading glibc 2.35..."mkdir -p ${GLIBC_DIR}cd /tmpcurl -fsSL -o libc6.deb "${LIBC6_DEB_URL}"@@ -54,13 +77,14 @@ rm -f libc6.deb data.tar data.tar.zst control.tar.zst debian-binarycd -# Patch the compositor binary+echo "[patch-compositor] Patching binary with patchelf..."patchelf \\--set-interpreter ${GLIBC_DIR}/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 \\--force-rpath \\--set-rpath ${GLIBC_DIR}/lib/x86_64-linux-gnu:\\$ORIGIN \\"$COMPOSITOR_BIN"-echo "Compositor patched successfully"+echo "[patch-compositor] Compositor patched successfully"`;const cmd = await sandbox.runCommand({@@ -69,9 +93,8 @@ echo "Compositor patched successfully"detached: true,});- // eslint-disable-next-line @typescript-eslint/no-unused-varsfor await (const _log of cmd.logs()) {- // Consume logs+ console.log(_log.data);}const result = await cmd.wait();