@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 new1 fixed
Release note
Patch Changes
Coalesce concurrent
Sandbox.destroy()calls onto a single teardown. If a
previousdestroy()is still in flight, subsequent calls await the same
underlying work instead of starting a second teardown, and emit a canonicalsandbox.destroy.coalescedevent per coalesced call for observability.
Once the in-flight teardown settles, laterdestroy()calls run a fresh
teardown as before. Fixes observed destroy-recreate thrash where external
health checks can invokedestroy()faster than the sandbox can initialize.Add
sandbox.getContainerPlacementId()to retrieve the Cloudflare placement ID
observed for the underlying container.The placement ID identifies the current container placement and changes when
the container is replaced by the platform. Compare the returned value against
a stored value to detect container replacement and trigger reconciliation.The placement ID is captured during the session-create handshake and cached
in Durable Object storage, so reads are cheap and do not require a healthy
container. A fresh placement ID is captured on each subsequent handshake,
so a replacement is reflected the next time the sandbox is used.Returns
undefinedwhen no session-create handshake has been observed yet on
this sandbox — call any method that triggers session creation (such asexec()) first. Returnsnullwhen a handshake has completed but the
container'sCLOUDFLARE_PLACEMENT_IDenvironment variable is not set, such as
in local development with wrangler.await sandbox.exec('true'); // ensures the handshake has run const containerPlacementId = await sandbox.getContainerPlacementId(); if ( typeof containerPlacementId === 'string' && containerPlacementId !== lastKnownPlacementId ) { // Container was replaced — reconcile state }
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.