Skip to main content

getOrCreateSandbox()v4.0.425

The primary entry point for getting a sandbox. Automatically handles the dev/prod routing:

  • Development (no VERCEL env var): Creates a fresh sandbox from scratch using createSandbox().
  • Production (on Vercel): Restores a sandbox from a cached snapshot. Throws an error if no snapshot is found.

Example

await using sandbox = await getOrCreateSandbox({
  bundleDir: '.remotion',
  onProgress: ({progress, message}) => {
    console.log(`${message} (${Math.round(progress * 100)}%)`);
  },
});

Arguments

An object with the following properties:

bundleDir

The path to your Remotion bundle directory, relative to the current working directory.

onProgress?

A callback that receives progress updates. Only called during development when a fresh sandbox is created.

Return value

A VercelSandbox object.

See also