Skip to content

Conversation

@agents-git-bot
Copy link
Contributor

Summary

Document behavior change where undefined/null values in environment variable APIs now unset variables instead of throwing errors.

Related to cloudflare/sandbox-sdk PR #342: cloudflare/sandbox-sdk#342

Changes

  • New section: Added "Unsetting environment variables" with examples showing undefined/null behavior
  • Type updates: Updated all env parameter types to Record<string, string | undefined>
  • API documentation: Updated setEnvVars(), exec(), startProcess(), and createSession() parameter docs
  • Examples: Added examples showing conditional environment setup patterns

Key behavior changes

Before: sandbox.setEnvVars({ KEY: undefined }) threw a runtime error
After: sandbox.setEnvVars({ KEY: undefined }) runs unset KEY

This enables idiomatic JavaScript patterns:

await sandbox.setEnvVars({
  API_KEY: 'new-key',
  OLD_SECRET: undefined // unsets OLD_SECRET
});

Document new behavior where undefined/null values in setEnvVars, exec options,
and session creation now unset variables instead of throwing errors.

- Add new 'Unsetting environment variables' section with examples
- Update type signatures to Record<string, string | undefined>
- Add examples showing undefined behavior in all env contexts
- Document use cases for conditional environment setup

Related to cloudflare/sandbox-sdk PR #342
@github-actions
Copy link
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/docs/sandbox/ @whoiskatrin, @ghostwriternr, @cloudflare/pcx-technical-writing, @cloudflare/ai-agents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants