Skip to content

🎥 Make videos programmatically with React

remove all snapshot functionality

umungobungo75d5322cd186
diff --git a/packages/template-vercel/.env.example b/packages/template-vercel/.env.example
index 49c2a143b7..6971d3013b 100644
--- a/packages/template-vercel/.env.example
+++ b/packages/template-vercel/.env.example
@@ -9,8 +9,3 @@
# URL of your deployed Remotion bundle (optional - if not set, will bundle on-demand)
# REMOTION_SERVE_URL=https://your-remotion-bundle.vercel.app
-
-# Sandbox Snapshot ID (optional - speeds up renders by skipping setup)
-# Create a snapshot by running: bun run create-snapshot
-# Note: Snapshots expire after 7 days
-# SANDBOX_SNAPSHOT_ID=
diff --git a/packages/template-vercel/README.md b/packages/template-vercel/README.md
index 5de3714e99..18383236c5 100644
--- a/packages/template-vercel/README.md
+++ b/packages/template-vercel/README.md
@@ -114,27 +114,6 @@ npm run dev
5. Completed video is uploaded to Vercel Blob
6. User receives the video URL
-## Speed Up Renders with Snapshots
-
-Each fresh sandbox creation installs system dependencies, `@remotion/renderer`, and downloads headless Chrome. You can skip this setup by creating a sandbox snapshot:
-
-```bash
-bun run create-snapshot
-```
-
-This creates a pre-configured sandbox with everything installed. Copy the snapshot ID and add it to your environment:
-
-```bash
-# .env.local (for local development)
-SANDBOX_SNAPSHOT_ID=snap_xxxxx
-
-# Or add to Vercel project settings for production
-```
-
-With a snapshot, renders skip the setup phase and start rendering immediately.
-
-**Note:** Snapshots expire after 7 days. Run `bun run create-snapshot` again to create a new one.
-
## Docs
Get started with Remotion by reading the [fundamentals page](https://www.remotion.dev/docs/the-fundamentals).
diff --git a/packages/template-vercel/package.json b/packages/template-vercel/package.json
index 9d5e6d85a3..e50dad7d80 100644
--- a/packages/template-vercel/package.json
+++ b/packages/template-vercel/package.json
@@ -8,8 +8,7 @@
"start": "next start",
"lint": "eslint .",
"remotion": "remotion studio",
- "render": "remotion render",
- "create-snapshot": "bun scripts/create-snapshot.ts"
+ "render": "remotion render"
},
"dependencies": {
"@remotion/cli": "workspace:*",
diff --git a/packages/template-vercel/scripts/create-snapshot.ts b/packages/template-vercel/scripts/create-snapshot.ts
deleted file mode 100644
index 3186efaafa..0000000000
--- a/packages/template-vercel/scripts/create-snapshot.ts
+++ /dev/null
@@ -1,173 +0,0 @@
-/**
- * Creates a Vercel Sandbox snapshot with all dependencies pre-installed.
- *
- * This script:
- * 1. Creates a new sandbox
- * 2. Installs system dependencies (for headless Chrome)
- * 3. Installs @remotion/renderer
- * 4. Downloads headless Chrome browser
- * 5. Takes a snapshot
- *
- * The snapshot ID can then be used in SANDBOX_SNAPSHOT_ID env var
- * to skip setup on future renders.
- *
- * https://vercel.com/docs/vercel-sandbox/concepts/snapshots
- * Note: Snapshots expire after 7 days.
- */
-
-import { Sandbox, Snapshot } from "@vercel/sandbox";
-
-async function createSnapshot() {
- console.log("=== Remotion Sandbox Snapshot Creator ===\n");
-
- // List existing snapshots
- console.log("Checking for existing snapshots...");
- const {
- json: { snapshots },
- } = await Snapshot.list();
-
- if (snapshots.length > 0) {
- console.log(`Found ${snapshots.length} existing snapshot(s):`);
- for (const snap of snapshots) {
- const expiresAt = new Date(snap.expiresAt).toLocaleDateString();
- console.log(` - ${snap.id} (expires: ${expiresAt})`);
- }
- console.log("");
- }
-
- console.log("Creating new sandbox...");
- const sandbox = await Sandbox.create({
- runtime: "node24",
- timeout: 10 * 60 * 1000,
- });
- console.log(`Sandbox created: ${sandbox.sandboxId}\n`);
-
- try {
- // Step 1: Install system dependencies for headless Chrome
- console.log("Installing system dependencies...");
- const sysInstallCmd = await sandbox.runCommand({
- cmd: "sudo",
- args: [
- "dnf",
- "install",
- "-y",
- "nss",
- "atk",
- "at-spi2-atk",
- "cups-libs",
- "libdrm",
- "libXcomposite",
- "libXdamage",
- "libXrandr",
- "mesa-libgbm",
- "alsa-lib",
- "pango",
- "gtk3",
- ],
- detached: true,
- });
-
- for await (const log of sysInstallCmd.logs()) {
- process.stdout.write(log.data);
- }
-
- const sysResult = await sysInstallCmd.wait();
- if (sysResult.exitCode !== 0) {
- throw new Error(
- `System dependencies install failed with exit code ${sysResult.exitCode}`,
- );
- }
- console.log("System dependencies installed.\n");
-
- // Step 2: Install @remotion/renderer
- console.log("Installing @remotion/renderer...");
- const installCmd = await sandbox.runCommand({
- cmd: "pnpm",
- args: ["install", "@remotion/renderer@latest"],
- detached: true,
- });
-
- for await (const log of installCmd.logs()) {
- process.stdout.write(log.data);
- }
-
- const installResult = await installCmd.wait();
- if (installResult.exitCode !== 0) {
- throw new Error(
- `pnpm install failed with exit code ${installResult.exitCode}`,
- );
- }
- console.log("@remotion/renderer installed.\n");
-
- // Step 3: Download headless Chrome browser
- console.log("Downloading headless Chrome browser...");
-
- const ensureBrowserScript = `
-const { ensureBrowser } = require("@remotion/renderer");
-
-async function main() {
- console.log("Ensuring browser is downloaded...");
- await ensureBrowser();
- console.log("Browser download complete!");
-}
-
-main().catch((err) => {
- console.error("Failed to ensure browser:", err.message);
- process.exit(1);
-});
-`;
-
- await sandbox.writeFiles([
- {
- path: "ensure-browser.cjs",
- content: Buffer.from(ensureBrowserScript),
- },
- ]);
-
- const browserCmd = await sandbox.runCommand({
- cmd: "node",
- args: ["ensure-browser.cjs"],
- detached: true,
- });
-
- for await (const log of browserCmd.logs()) {
- process.stdout.write(log.data);
- }
-
- const browserResult = await browserCmd.wait();
- if (browserResult.exitCode !== 0) {
- throw new Error(
- `Browser download failed with exit code ${browserResult.exitCode}`,
- );
- }
- console.log("Headless Chrome downloaded.\n");
-
- // Step 4: Create snapshot
- console.log("Creating snapshot...");
- const snapshot = await sandbox.snapshot();
-
- console.log("\n=== Snapshot Created Successfully ===");
- console.log(`Snapshot ID: ${snapshot.snapshotId}`);
- console.log(`Size: ${(snapshot.sizeBytes / 1024 / 1024).toFixed(2)} MB`);
- console.log(`Expires: ${snapshot.expiresAt.toLocaleDateString()}`);
- console.log(`\nTo use this snapshot, set the environment variable:`);
- console.log(` SANDBOX_SNAPSHOT_ID=${snapshot.snapshotId}`);
-
- return snapshot.snapshotId;
- } catch (error) {
- console.error("Error during snapshot creation:", error);
- // Sandbox auto-stops after snapshot(), but if we error before that, clean up
- await sandbox.stop().catch(() => {});
- throw error;
- }
-}
-
-createSnapshot()
- .then(() => {
- console.log(`\nDone! Shutting down sandbox.`);
- process.exit(0);
- })
- .catch((err) => {
- console.error("Failed to create snapshot:", err);
- process.exit(1);
- });
diff --git a/packages/template-vercel/src/app/api/render/route.ts b/packages/template-vercel/src/app/api/render/route.ts
index e04d26a4ac..3a257bc67f 100644
--- a/packages/template-vercel/src/app/api/render/route.ts
+++ b/packages/template-vercel/src/app/api/render/route.ts
@@ -79,8 +79,6 @@ export async function POST(req: Request) {
);
}
- const snapshotId = process.env.SANDBOX_SNAPSHOT_ID;
-
let sandbox: Sandbox | null = null;
const encoder = new TextEncoder();
@@ -96,81 +94,66 @@ export async function POST(req: Request) {
const payload = await req.json();
const body = RenderRequest.parse(payload);
- // If we have a snapshot, use it to skip setup
- if (snapshotId) {
- await send({
- type: "phase",
- phase: "Creating sandbox from snapshot...",
- });
-
- sandbox = await Sandbox.create({
- source: { type: "snapshot", snapshotId },
- timeout: 5 * 60 * 1000,
- });
- } else {
- await send({ type: "phase", phase: "Creating sandbox..." });
-
- sandbox = await Sandbox.create({
- runtime: "node24",
- timeout: 5 * 60 * 1000,
- });
-
- await send({
- type: "phase",
- phase: "Installing system dependencies...",
- });
-
- const sysInstallCmd = await sandbox.runCommand({
- cmd: "sudo",
- args: [
- "dnf",
- "install",
- "-y",
- "nss",
- "atk",
- "at-spi2-atk",
- "cups-libs",
- "libdrm",
- "libXcomposite",
- "libXdamage",
- "libXrandr",
- "mesa-libgbm",
- "alsa-lib",
- "pango",
- "gtk3",
- ],
- detached: true,
- });
-
- for await (const log of sysInstallCmd.logs()) {
- await send({ type: "log", stream: log.stream, data: log.data });
- }
+ await send({ type: "phase", phase: "Creating sandbox..." });
- const sysInstallResult = await sysInstallCmd.wait();
- if (sysInstallResult.exitCode !== 0) {
- throw new Error(
- `System dependencies install failed: ${await sysInstallResult.stderr()}`,
- );
- }
+ sandbox = await Sandbox.create({
+ runtime: "node24",
+ timeout: 5 * 60 * 1000,
+ });
- await send({ type: "phase", phase: "Installing renderer..." });
+ await send({
+ type: "phase",
+ phase: "Installing system dependencies...",
+ });
- const installCmd = await sandbox.runCommand({
- cmd: "pnpm",
- args: ["install", "@remotion/renderer@latest"],
- detached: true,
- });
+ const sysInstallCmd = await sandbox.runCommand({
+ cmd: "sudo",
+ args: [
+ "dnf",
+ "install",
+ "-y",
+ "nss",
+ "atk",
+ "at-spi2-atk",
+ "cups-libs",
+ "libdrm",
+ "libXcomposite",
+ "libXdamage",
+ "libXrandr",
+ "mesa-libgbm",
+ "alsa-lib",
+ "pango",
+ "gtk3",
+ ],
+ detached: true,
+ });
- for await (const log of installCmd.logs()) {
- await send({ type: "log", stream: log.stream, data: log.data });
- }
+ for await (const log of sysInstallCmd.logs()) {
+ await send({ type: "log", stream: log.stream, data: log.data });
+ }
- const installResult = await installCmd.wait();
- if (installResult.exitCode !== 0) {
- throw new Error(
- `pnpm install failed: ${await installResult.stderr()}`,
- );
- }
+ const sysInstallResult = await sysInstallCmd.wait();
+ if (sysInstallResult.exitCode !== 0) {
+ throw new Error(
+ `System dependencies install failed: ${await sysInstallResult.stderr()}`,
+ );
+ }
+
+ await send({ type: "phase", phase: "Installing renderer..." });
+
+ const installCmd = await sandbox.runCommand({
+ cmd: "pnpm",
+ args: ["install", "@remotion/renderer@latest"],
+ detached: true,
+ });
+
+ for await (const log of installCmd.logs()) {
+ await send({ type: "log", stream: log.stream, data: log.data });
+ }
+
+ const installResult = await installCmd.wait();
+ if (installResult.exitCode !== 0) {
+ throw new Error(`pnpm install failed: ${await installResult.stderr()}`);
}
await send({ type: "phase", phase: "Rendering video..." });