cloudflare/sandbox-sdk @cloudflare/sandbox@0.8.14
cloudflare/sandbox-sdk
Captured source
source ↗@cloudflare/sandbox@0.8.14
Repository: cloudflare/sandbox-sdk
Tag: @cloudflare/sandbox@0.8.14
Published: 2026-04-24T08:23:54Z
Prerelease: no
Release notes:
Patch Changes
- #613 `174313f` Thanks @ghostwriternr! - Avoid duplicate session-create calls when parallel operations hit a
fresh sandbox. Parallel callers now share one setup call instead of each issuing their own. Sequential operations are unaffected.
Session setup also now retries cleanly on the next operation if it is interrupted partway through — including by a container stop during first use — instead of leaving the sandbox in a state that looks initialized but references a session the container no longer has.
- #624 `bbdfd95` Thanks @ghostwriternr! - Fix sandboxes staying alive past their configured
sleepAftervalue.
Workers that passed configuration options to getSandbox() on every request (sleepAfter, keepAlive, or containerTimeouts) could unintentionally extend sandbox lifetimes. The SDK's internal reapply path treated identical reapplied values as activity, resetting the sleep timer each time. Under sustained traffic, sandboxes would never sleep at all.
After updating, reapplying the same configuration value is a true no-op. Your getSandbox() calls continue to work exactly as before; sandboxes now respect their configured sleep timers regardless of how often configuration is reapplied.
This release also removes the unused baseUrl option from SandboxOptions, along with the setBaseUrl RPC method on the Sandbox Durable Object. The option had no effect on runtime behavior; preview URLs are driven by the hostname passed to preview-URL APIs. If you were setting baseUrl on getSandbox(), you can safely remove it. Directly invoking the undocumented setBaseUrl RPC method will now error.
- #629 `34e3a96` Thanks @aron-cf! - Improve reliability of
desktop.stop()as well as general isolation of the desktop processes by
running them in a subprocess. This should ensure that processes are cleaned up when calling desktop.stop() and crashes should not impact the sandbox container service.
- #576 `9222fd0` Thanks @whoiskatrin! - Fix stream controller race condition causing "Invalid state: Controller is already closed" errors
Resolves an issue where client disconnections during streaming operations could cause unhandled TypeError exceptions, potentially corrupting the SDK bridge state. The fix adds defensive error handling in the execute streaming handler to gracefully handle callbacks firing after stream cancellation.
- #614 `74a58e9` Thanks @aron-cf! - Adds a new
transport: 'http' | 'websocket'field to thegetSandbox()options. This can be
used to dynamically select transport on a per-sandbox basis.
> [!NOTE] > Changing transport on an already existing sandbox may result in dropped connections, it is > recommended to keep the same transport for the lifetime of the sandbox instance.
const sandbox = getSandbox(env.Sandbox, 'my-sandbox', {
transport: 'websocket'
});