Codesandbox-client: CodeSandboxs are broken with 502: Bad Gateway

Created on 14 Jan 2019  路  12Comments  路  Source: codesandbox/codesandbox-client

馃悰 bug report

I have two CodeSandboxes that are imported from GitHub, both seem to be broken while they used to just a few hours ago.

image

All 12 comments

Hey @nikolasburk , it's because you changed the start script, which is the one we run when a server sandbox is started.

Thanks a lot for the quick reply @lbogdan 馃檹 I indeed adjusted the start script, but I guess I don't understand why this is breaking the CSB now.

The start script now should simply run the info.{ts,js} script to print something to the console. Do you have a recommended fix?

We assume the start script (actually, we look for dev, develop, serve, start, in this particular order) starts the main process of the sandbox (the dev server, if you will). So, instead of demo, you can use one of dev, develop or serve.

But I do want the start script to be executed 馃檪it provides the instructions for people to get started. The prior yarn start was of no use because it triggered an interactive CLI that could not be used in the imported CSB. That's why I changed it to yarn demo, so that it doesn't get executed by default any more.

So what would you expect to see on https://rlkyjwx2nq.sse.codesandbox.io/, if there is no server running?

Ah sorry, that's of course a valid point! I actually wouldn't have expected anything because there's indeed no server running. However, the prior behaviour seemed to be that the embedded browser would show the terminal that runs the yarn start command:

image

That's why I expected to see the terminal output that's printed with the new yarn start command. Maybe this wasn't the expected behaviour in the first place and now everything is as expected?

It only shows that while the sandbox is started, so you can have some feedback while you're waiting for it to start. After that, it expects that one of those scripts I enumerated earlier starts a webserver, which it will then expose on https://sandbox-id.sse.codesandbox.id, or show the 502 page if no webserver is running.

Ok, that makes sense. Thanks a lot for the explanations! 馃檹

I guess what I really need is this feature then, so that people who want to use the demo can jump right into the terminal and do not get distracted by the error in the browser.

Or you could start a small express server that would serve a static page with the setup instructions. 馃檪

I'd suggest a more helpful error message that there's no server running. Maybe fallback to the CLI output while there is no HTTP server reachable.

@schickling Isn't "We had trouble connecting to the server, try restarting it or check the logs to see what happened." helpful enough?
I guess we could fallback to the CLI (although it's a bit tricky to implement because of the current architecture), but then again we kind of assume there's a webserver running in the sandbox at all times, so it makes sense to show an error page when that's not the case, instead of just showing the CLI.

I don't think it's helpful enough, that's why I brought it up :)

Completely understand that it can be difficult to implement but right now UX is clearly suffering from it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

faceyspacey picture faceyspacey  路  3Comments

k15a picture k15a  路  3Comments

waruyama picture waruyama  路  3Comments

Haroenv picture Haroenv  路  3Comments

zocky picture zocky  路  3Comments