Skip to content

Conversation

@agents-git-bot
Copy link
Contributor

@agents-git-bot agents-git-bot bot commented Nov 25, 2025

Summary

Documents automatic Promise resolution in JavaScript and TypeScript code execution contexts. This update clarifies the behavior fixed in cloudflare/sandbox-sdk#246.

Changes

  • API Reference (/sandbox/api/interpreter.mdx):

    • Added async code execution examples showing Promise resolution
    • Added async error handling examples for rejected promises
    • Documents that async IIFE and Promise.resolve() return resolved values
  • How-to Guide (/sandbox/guides/code-execution.mdx):

    • Added new section on executing async JavaScript/TypeScript
    • Practical examples of async data operations
    • Error handling patterns for async code

Background

Previously, async code like (async () => 42)() or Promise.resolve(123) would return {} instead of the resolved value. The fix in PR #246 now automatically awaits Promise results, making async code execution work as expected.

Related

@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

@agents-git-bot agents-git-bot bot changed the title Document Promise handling in JavaScript/TypeScript code execution Document async/await and Promise handling in Code Interpreter (sync PR #246) Nov 25, 2025
Adds documentation for automatic Promise resolution in JavaScript and
TypeScript contexts. The Code Interpreter now properly awaits Promise
results, allowing async/await patterns to work correctly.

Includes examples for:
- Async IIFE patterns
- Direct Promise.resolve usage
- Nested async operations
- Async error handling with Promise.reject

References cloudflare/sandbox-sdk#246
Adds practical examples of async JavaScript/TypeScript execution to the
how-to guide, demonstrating data processing workflows with Promises.

References cloudflare/sandbox-sdk#246
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