Skip to content

🎥 Make videos programmatically with React

`@remotion/vercel`: Add `timeoutInMilliseconds` option to `createSandbox()`

umairnadeem34e5ac1e3cc7
diff --git a/packages/docs/docs/vercel/create-sandbox.mdx b/packages/docs/docs/vercel/create-sandbox.mdx
index b3c021afe7..78a48bdcb2 100644
--- a/packages/docs/docs/vercel/create-sandbox.mdx
+++ b/packages/docs/docs/vercel/create-sandbox.mdx
@@ -71,6 +71,12 @@ const sandbox = await createSandbox({
Default: `{vcpus: 4}`.
+### `timeoutInMilliseconds?`
+
+The maximum time allowed for the sandbox to be created, in milliseconds. If exceeded, sandbox creation is aborted.
+
+Default: `300000` (5 minutes).
+
## Return value
A [`VercelSandbox`](/docs/vercel/types#vercelsandbox) object (a [`Sandbox`](https://vercel.com/docs/vercel-sandbox/sdk-reference#sandbox-class) with `AsyncDisposable` support).
diff --git a/packages/vercel/src/create-sandbox.ts b/packages/vercel/src/create-sandbox.ts
index 1f61f2c1d1..7c33dc5695 100644
--- a/packages/vercel/src/create-sandbox.ts
+++ b/packages/vercel/src/create-sandbox.ts
@@ -18,9 +18,11 @@ export const SANDBOX_CREATING_TIMEOUT = 5 * 60 * 1000;
export async function createSandbox({
onProgress,
resources = {vcpus: 4},
+ timeoutInMilliseconds = SANDBOX_CREATING_TIMEOUT,
}: {
onProgress?: CreateSandboxOnProgress;
resources?: CreateSandboxResources;
+ timeoutInMilliseconds?: number;
} = {}): Promise<VercelSandbox> {
const report = async (progress: number, message: string) => {
await onProgress?.({progress, message});
@@ -29,7 +31,7 @@ export async function createSandbox({
const sandbox = await createDisposableSandbox({
runtime: 'node24',
resources,
- timeout: SANDBOX_CREATING_TIMEOUT,
+ timeout: timeoutInMilliseconds,
});
// Preparation has 2 stages with weights: