Skip to content

Sandbox Snapshots

Junior plugins can declare sandbox runtime dependencies such as npm CLIs, system packages, and postinstall commands. Junior turns those declarations into a single runtime dependency profile and stores the resolved Vercel Sandbox snapshot in Redis.

Snapshots are used only when loaded plugins declare runtime dependencies or runtime postinstall commands. If the dependency profile is empty, Junior creates a base sandbox without snapshot warmup.

The common deploy path runs snapshot warmup during build:

package.json
{
"scripts": {
"build": "junior snapshot create && vite build"
}
}

Junior computes the snapshot profile from loaded plugin declarations:

InputSource
RuntimeJunior sandbox runtime, currently node22.
npm dependenciesPlugin runtime-dependencies entries with type: npm.
system dependenciesPlugin runtime-dependencies entries with type: system.
postinstall commandsPlugin runtime-postinstall entries.
manual rebuild epochSANDBOX_SNAPSHOT_REBUILD_EPOCH, when set.

Any change to those inputs produces a new profile hash and a new snapshot.

Snapshot metadata is stored in Redis by profile hash. Junior serializes rebuilds for the same profile so concurrent builds do not create duplicate snapshots.

Rebuilds happen when:

  • the profile hash is new
  • the cached snapshot is missing or stale
  • SANDBOX_SNAPSHOT_REBUILD_EPOCH changes
  • floating dependency selectors are older than SANDBOX_SNAPSHOT_FLOATING_MAX_AGE_MS

The default floating dependency max age is seven days. Set SANDBOX_SNAPSHOT_FLOATING_MAX_AGE_MS=0 only when you intentionally want floating dependencies rebuilt every time.

Snapshot build failures are deploy blockers. Junior must not silently continue with partially installed dependencies.

Check these first:

SymptomFirst check
OIDC missingVercel OIDC is available during build.
Redis registry errorsREDIS_URL is available during build.
CLI not found in turnsPlugin runtime dependency declaration and snapshot build logs.
Browser or binary launch failureRuntime postinstall command ran successfully.

Run snapshot warmup directly:

Terminal window
pnpm exec junior snapshot create

Confirm the final line includes Sandbox snapshot create complete and that dependency counts match the enabled plugins.

Use junior snapshot create for command details, then monitor snapshot behavior from Observability.