Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async Code Not Executing Correctly in e2b Sandbox Environment #477

Open
abubakar7033 opened this issue Nov 23, 2024 · 1 comment
Open

Async Code Not Executing Correctly in e2b Sandbox Environment #477

abubakar7033 opened this issue Nov 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@abubakar7033
Copy link

When executing JavaScript code containing asynchronous operations (e.g., async/await), the e2b Sandbox environment fails to execute the code as expected. Instead of resolving the asynchronous functions, the sandbox returns a Promise { } as a string or encounters a syntax error with await not being allowed outside async functions.

Steps to Reproduce:

Create an async function in the code to perform asynchronous tasks (e.g., fetch requests, setTimeout, etc.).
Use await to resolve the promise within the async function.
Execute the code in the e2b Sandbox environment using the runCode method.
Expected Behavior: The async function should run as expected, resolving the promise and providing the output. The asynchronous operations should be awaited, and their results should be returned correctly.

Actual Behavior:

The output is returned as Promise { } instead of the resolved result.
In some cases, a SyntaxError is thrown indicating that await is only valid in async functions or top-level modules.

Example Code:

@abubakar7033 abubakar7033 added the bug Something isn't working label Nov 23, 2024
Copy link

linear bot commented Nov 23, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant