codesandbox / codesandbox-client

An online IDE for rapid web development
https://codesandbox.io
Other
12.96k stars 2.26k forks source link

502 It looks like the dev server has not been started yet. Start from the editor ↗ #8442

Open huythai1602 opened 2 months ago

huythai1602 commented 2 months ago

I created a devbox in codesandbox and my preview really said this: 502 It looks like the dev server has not been started yet. [Start from the editor ↗] https://codesandbox.io/p/sandbox/photo-sharing-mrdmvk

filipelima18 commented 1 month ago

Hi. We released a fix today that solved some issues related to VM starts. Opening that URL just now, I was able to load it with no issues on my end. Can you check?

dushmanta05 commented 1 month ago

Faced the same issue now with my node.js application, did you got it resolved?

CompuIves commented 1 month ago

Can you share the link @dushmanta05? This message is given when the dev server is not started on the opened port, opening the editor should fix it, or starting a dev server on that port fixes it.

dushmanta05 commented 1 month ago

@CompuIves Unfortunately, I can't share because of confidentiality because the project is my work. I was trying CodeSandbox because I faced some issues in my local. I'll try to provide as much information as I can tomorrow. Thanks.

CompuIves commented 1 month ago

Okay, well, in any case it should work if you start the dev server.

parnika30 commented 1 month ago

how to resolve this issue?

filipelima18 commented 1 month ago

Hi @parnika30. Typically, you can fix this by clicking the "Start from the editor" button and then, on the right panel, clicking "Open Preview".

jamalbernhard commented 2 weeks ago

I am seeing this issue in ALL of my devboxes right now and it's extremely frustrating. I'm supposed to be giving a coding interview in 10 hours and it looks like I will have to cancel and reschedule because I can't get preview windows working. When I click "Start from the editor" it just seems to load a new editor instance inside the preview (right-hand) pane, and continuing to click "Open preview" after that does nothing new. Grrrrr.

cfenzo commented 2 weeks ago

I ran into the same issue after upgrading a devbox to the latest version, using the "React + Tailwind" template. Browser: Google Chrome (OS X) 125.0.6422.176 (Official Build) (x86_64)

It tries to preview "dev:5173", and I get the error: This task of this preview has a port configured, but it's not opened.

Screenshot 2024-06-20 at 07 18 03

If I try to open the correct csb.app url in a tab, the error message is the same as the one in the title here.

Screenshot 2024-06-20 at 07 18 09

I can see in the terminal for the current task (dev), that the vite command has no errors and is listening on port 5173.

Screenshot 2024-06-20 at 07 17 54

In console there's an error:

Screenshot 2024-06-20 at 07 38 48

I tried to restart the VM and also reload the window a couple more times, and now the preview tab is gone, and there is no choice in any menu for "open preview", only "open documentation".

Screenshot 2024-06-20 at 07 43 51

I've cleared the application data in dev tools and tried the "Reset choice for 'file operation needs preview'" that I've previously have had to use to get the preview back, but nothing changes. I've also tried opening the devbox in Safari, with the same result.

I made a fork of the devbox and removed all client code. It has the same issues: https://codesandbox.io/p/devbox/failing-devbox-forked-j4v5v8

jamalbernhard commented 2 weeks ago

@cfenzo Yes updating to the latest VM seems to be causing the issue. Even if I just start a brand new React + TS devbox from their Vite template and then immediately update to the latest VM, preview is broken!

jarvis8x7b commented 2 weeks ago

using the API to create devboxes and facing this issue as well, previously devboxes always started by themselves and preview was available but now it's always "502 It looks like the dev server has not been started yet". is there a way to programmatically start the devboxes?

vivekanand04 commented 2 weeks ago

502 It looks like the dev server has not been started yet. Start from the editor ↗ why it is happening ????????????

vivekanand04 commented 2 weeks ago

solution i have same problem but have a backup idea make a new reposatory in codesandbox and copy paste your this code into new created folder.

ifakhfakh commented 1 week ago

I found solution for this in case it's an angular project . Try opening the terminal then run: ng serve . If it tells you that ng command is not known, then execute sudo npm install -g @angular/cli. After that run ng serve. After it finishes, you will see a small pop-in with two options: open preview or open externally.

filipelima18 commented 1 week ago

Hi. Last Friday, we released a fix for some of the most common issues that prevented previews from starting. To get the fix to work:

  1. Update the editor to the latest version if needed (a notification will show up on the top left of the editor if it's outdated).
  2. Restart the VM by clicking the CodeSandbox logo at the top left and then "Restart Devbox".