[ERROR] Making POST request to undefined/api/execute/

Attempting to run @cloudflare/sandbox, simply running:
const sandbox = getSandbox(env.SANDBOX, "sandbox-test");
const result = await sandbox.exec("ls", args ?? []);
const sandbox = getSandbox(env.SANDBOX, "sandbox-test");
const result = await sandbox.exec("ls", args ?? []);
The sandbox seems to start on port 3000, but running this I get:
[HTTP Client] Making POST request to undefined/api/execute/
✘ [ERROR] [HTTP Client] Request error: POST undefined/api/execute [TypeError: Invalid URL: undefined/api/execute]
[HTTP Client] Making POST request to undefined/api/execute/
✘ [ERROR] [HTTP Client] Request error: POST undefined/api/execute [TypeError: Invalid URL: undefined/api/execute]
- Container builds successfully Anyone any idea why?
1 Reply
ItsWendell
ItsWendellOP2mo ago
GitHub
TypeError: Invalid URL: undefined/api/execute when using sandbox ...
Description When attempting to execute a command within a Worker sandbox environment, the request fails with a TypeError: Invalid URL. This suggests that the base URL might not be set or doesn'...

Did you find this page helpful?