@cloudflare/sandbox
1.0.3 · 22 Oct 2026Apache-2.02.1M / weekRepositoryHomepagenpmAtom feed
0.12.14 is the newest release of 0.9.x.
In short
1 fixed
Release note
Minor Changes
Handle shell exits with
SessionTerminatedError, and let the same session id recover on the next call.import { SessionTerminatedError } from '@cloudflare/sandbox'; const session = await sandbox.createSession({ id: 'build' }); try { await session.exec('exit 42'); } catch (error) { if (error instanceof SessionTerminatedError) { console.log(error.exitCode); // 42 await session.exec('echo fresh shell'); } }If a session's shell exits, the failing call now returns
SESSION_TERMINATED
(HTTP 410) with the observed exit code instead of a generic internal error.
Retrying with the same session id, or callingcreateSession({ id }), starts a
fresh session without destroying the whole sandbox. Session-local state such as
the working directory, environment variables, shell functions, and background
jobs is lost when the shell exits.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.