e2b-dev / fragments

Open-source Next.js template for building apps that are fully generated by AI. By E2B.
https://fragments.e2b.dev
Apache License 2.0
3.48k stars 455 forks source link

Bad Gateway for Custom Sandbox #51

Open btahir opened 2 months ago

btahir commented 2 months ago

I'm experiencing difficulties while trying to set up and use a custom sandbox. Specifically:

After deploying a sandbox, I consistently receive a "Bad Gateway" error when attempting to access the artifact.

I did get this message when I created Sandbox

adduser: The home directory `/home/user' already exists.  Not touching this directory.
adduser: Warning: The home directory `/home/user' does not belong to the user you are currently creating.
Postprocessing finished.

Could be the Dockerfile for nextjs template needs updating. You also need to change the shadcn commands to

RUN npx shadcn-ui@latest init -d
RUN npx shadcn-ui@latest add --all

sahdcn-ui becomes shadcn in the latest version.

Steps To Reproduce I think you can try building a new Sandbox using the nextjs template here and hopefully fix the issues by updating the Dockerfile.

linear[bot] commented 2 months ago

E2B-642 Bad Gateway for Custom Sandbox

jakubno commented 2 months ago

Hi @btahir, I think the problem is you don't specify start_cmd, so the nextjs servrer doens't start and when you try to access the port, it will return 502.

Could you please share your Dockerfile + e2b.toml? It would be easier to me to help you then

mishushakov commented 2 months ago

I'm suspecting the server doesn't start for some reason.

You can also ssh into to your sandbox using E2B CLI:

e2b sbx spawn <template id>

to see what's going wrong there

btahir commented 2 months ago

I'm using the nextjs template so you can reproduce this just trying to create a new sandbox using the Dockerfile + compute.sh file there. https://github.com/e2b-dev/ai-artifacts/tree/main/sandbox-templates/nextjs-developer