E2B icon indicating copy to clipboard operation
E2B copied to clipboard

502 Timeout Error

Open manavAt1flow opened this issue 9 months ago • 7 comments

Getting Sandbox timeout errors all the time, could you please help me what can be wrong here?

import dotenv from 'dotenv'
import { Sandbox } from '@e2b/code-interpreter'

dotenv.config()

const sandbox = await Sandbox.create("code-interpreter-v1", {
    timeoutMs: 300000,
    requestTimeoutMs: 300000,
})

const execution = await sandbox.runCode('x = 1;x+=1; x')

console.log(execution.text)

Error Response

       return new import_e2b.TimeoutError(
               ^

TimeoutError: <html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.27.0</center>
</body>
</html>
: This error is likely due to sandbox timeout. You can modify the sandbox timeout by passing 'timeoutMs' when starting the sandbox or calling '.setTimeout' on the sandbox with the desired timeout.

manavAt1flow avatar Feb 25 '25 04:02 manavAt1flow

Is this running on the e2b cloud or your self-hosted version? If it's the self-hosted version, could you check if you included the start command when building the code interpreter template?

jakubno avatar Feb 25 '25 08:02 jakubno

Hey @jakubno, Yes its self-hosted version, i am following according to docs https://e2b.dev/docs/quickstart/install-custom-packages

Here is e2b.Dockerfile

FROM e2bdev/code-interpreter:latest

# Install some Python packages
RUN pip install cowsay

manavAt1flow avatar Feb 25 '25 09:02 manavAt1flow

Getting this while building template with build start cmd.

 Error getting template build status: [500] internal server error: Failed to get the default team

manavAt1flow avatar Feb 25 '25 09:02 manavAt1flow

I got the same issue error 500 fetch failed。 use e2b cloud

haodaohong avatar Mar 03 '25 11:03 haodaohong

Hey @manavAt1flow , are you still getting this on the latest infra version?

mlejva avatar Mar 16 '25 14:03 mlejva

Yes @mlejva still getting internal server error: Failed to get the default team, usually this behavior is random every time i perform the build command, it gives different errors, on 2nd attempt it gives me this error

Error building environment: error snapshot for env 'td88rtwzob9e43xoum45' during build '5797379a-24c7-429b-be02-f381e3577f8d': error snapshotting fc: error creating vm snapshot: [PUT /snapshot/create][400] createSnapshotBadRequest &{FaultMessage:Create snapshot error: Cannot write memory file: Cannot dump memory: Guest memory error: Bad address (os error 14)}Build failed: error when building env: error when building env: rpc error: code = Unknown desc = error snapshot for env 'td88rtwzob9e43xoum45' during build '5797379a-24c7-429b-be02-f381e3577f8d': error snapshotting fc: error creating vm snapshot: [PUT /snapshot/create][400] createSnapshotBadRequest &{FaultMessage:Create snapshot error: Cannot write memory file: Cannot dump memory: Guest memory error: Bad address (os error 14)}

and on third attempt it gets succeeded.

manavAt1flow avatar Apr 03 '25 04:04 manavAt1flow