Run JavaScript inside an isolated Linux Sandbox from a durable Inngest function.
[!WARNING]
Inngest Sandboxes are currently an experimental beta. Access is enabled manually, and APIs, limits, and behavior can change. Use the beta for evaluation and feedback, not production workloads or data you cannot recreate.
The included function:
Each Sandbox operation is a durable Inngest step, so completed operations are memoized and visible in the function run.
You need an Inngest environment with Sandboxes beta access. Connect the deployed app to that environment through the Inngest Vercel integration, then sync its /api/inngest endpoint.
Open run-javascript-in-a-sandbox in the Inngest Dashboard, click Invoke, and use this payload:
{
"data": {
"code": "console.log('Hello from the sandbox!')"
}
}
The completed function returns:
{
"sandboxId": "...",
"stdout": "Hello from the sandbox!\n",
"stderr": "",
"exitCode": 0
}
Open the run to inspect the create, command, and destroy steps.
npm install
INNGEST_DEV=1 npm run dev
Open http://localhost:3000. INNGEST_DEV=1 keeps the local /api/inngest endpoint in development mode. Sandboxes are a cloud resource during the beta, so deploy and invoke the function through a Sandboxes-enabled Inngest Cloud environment to run the complete lifecycle.
src/
├── app/
│ ├── api/inngest/route.ts # Serves the Inngest function
│ └── page.tsx # A minimal starting page
└── inngest/
├── client.ts # Enables Sandbox middleware
└── functions/
└── run-javascript.ts # Creates, uses, and destroys a Sandbox
operation_ambiguous error without first reconciling the operation’s effects.