I'm getting started with CodeSandbox, and I mean to use it for https://github.com/UnlyEd/next-right-now, which is a Next.js public boilerplate.
I tried to import the project using the auto import githubbox for a specific branch https://githubbox.com/UnlyEd/next-right-now/tree/v1-hyb-mst-aptd-gcms-lcz-sty and it crashed right away with "Error fetching sandbox.".
The worse thing is that it doesn't tell me what fails, I've a complex project with lots of files and I don't know where the issue comes from.
I made various changes (and multiple full page refresh), at some point, I thought it may be related with the package.json:private field:
"private": true
I use "private": true because a Next.js app isn't meant to be deployed on npm, it's more of a security to avoid leaking source code by mistake.
After removing "private": true, it "worked", meaning the project was compiled, and failed then for other reasons.
Then, I deleted the sandbox and reimported it using https://githubbox.com/UnlyEd/next-right-now/tree/v1-hyb-mst-aptd-gcms-lcz-sty, and this time I didn't encounter the "Error fetching sandbox." (weird, I was expecting to get it again).
Now, I'm trying to make the sandbox start, but the code is quite complicated and I'm not sure how it's meant to work with Zeit/vercel. (I don't want to deploy on Vercel, but I'm using it and have a now.json file, but it's not meant to be used, it should use .env.build instead
I've downgraded the now CLI to v16.x because it was asking me to link my project to my Vercel account (but how am I supposed to do that on CodeSandbox? 🤔 )
Eventually, I made it compile, but the app itself doesn't work. It displays an error page instead of the expected page, even though the logs in the yarn start terminal look okay

Sandbox: https://codesandbox.io/s/long-breeze-56qrj?file=/package.json
I could use some help with the setup. Here is what I did after importing the github branch:
.env.build (copied from .env.build.example and added fake SENTRY_DSN to avoid crash)now.json (symlink to now.customer1.staging.json) by a proper .json file with now.customer1.staging.json content)now version with 16.7.3 in package.json to avoid having to authenticate to Vercel to run the project locallyRestarting the server outputs the following:
> Sandbox Container: Sandbox 56qrj started
yarn run v1.22.4
$ now dev --listen 8888
> UPDATE AVAILABLE Run `yarn add now@latest` to install Now CLI 19.0.1
> Changelog: https://github.com/zeit/now/releases/tag/[email protected]
> Now CLI 16.7.3 dev (beta) — https://zeit.co/feedback
> Creating initial build
Building Next with NODE_ENV="development" APP_STAGE="development" for CUSTOMER_REF="customer1"
warn - You have enabled experimental feature(s).
warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use them at your own risk.
Using experimental redirects: [ { source: '/:locale/',
destination: '/:locale',
permanent: false },
{ source: '/:locale/:path*/',
destination: '/:locale/:path*',
permanent: false } ]
Using experimental rewrites: [ { source: '/', destination: '/api/autoRedirectToLocalisedPage' },
{ source:
'/:locale((?!fr-FR|fr|en-US|en|robots|static|favicon.ico|_next)[^/]+)(.*)',
destination: '/api/autoRedirectToLocalisedPage' } ]
[webpack] Building release "1.0.1_development"
> Building @now/next@latest:package.json
> Error! Builder exited with 0 before sending build result
Building Next with NODE_ENV="development" APP_STAGE="development" for CUSTOMER_REF="customer1"
warn - You have enabled experimental feature(s).
warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use them at your own risk.
Using experimental redirects: [ { source: '/:locale/',
destination: '/:locale',
permanent: false },
{ source: '/:locale/:path*/',
destination: '/:locale/:path*',
permanent: false } ]
Using experimental rewrites: [ { source: '/', destination: '/api/autoRedirectToLocalisedPage' },
{ source:
'/:locale((?!fr-FR|fr|en-US|en|robots|static|favicon.ico|_next)[^/]+)(.*)',
destination: '/api/autoRedirectToLocalisedPage' } ]
[webpack] Building release "1.0.1_development"
event - compiled successfully
wait - compiling...
event - compiled successfully
> Built @now/next@latest:package.json [17s]
There seems to be an issue with the build > Error! Builder exited with 0 before sending build result which seems to restart.
Then, I refreshed the sandbox browser tab by clicking on the refresh button, and it logged the following:
event - build page: /[locale]
wait - compiling...
event - compiled successfully
2020-05-28T16:51:31.823Z [utils/i18n/i18nextLocize] info: Pre-fetching translations from https://api.locize.app/658fc999-dfa8-4307-b9d7-b4870ad5b968/latest/fr/common?build=1590684599934
2020-05-28T16:51:32.138Z [utils/i18n/i18nextLocize] info: Translations were resolved from Locize API and are now being memoized for subsequent calls
MultiversalAppBootstrap - App is ready, rendering...
2020-05-28T16:51:32.322Z [utils/i18n/i18nextLocize] info: Using "react-i18next" plugin
2020-05-28T16:51:32.322Z [utils/i18n/i18nextLocize] info: Using "i18next-locize-backend" plugin
2020-05-28T16:51:32.340Z [utils/i18n/i18nextLocize] info: Using "locize-lastused" plugin
2020-05-28T16:51:32.340Z [utils/i18n/i18nextLocize] info: Using 3 plugins in total
Which seems to work now... Well part of the app is broken (the Nav and Footer components have disappeared for example), here is what it should display:
https://nrn-v1-hyb-mst-aptd-gcms-lcz-sty-c1-i6tj62ina.now.sh

Url: https://56qrj.sse.codesandbox.io/fr (here it displays the Nav and Footer components properly) 🤷
Hard to tell why it worked suddenly, I haven't changed anything but only restarted the server (again).
Well, I just edited the README.md file, and it closed the port when I saved the file (Next fast refresh?)
Getting 502 error now.

The issue with Nav/Footer not being displayed on the embedded browser preview https://56qrj.sse.codesandbox.io/fr seems to be related to React rehydration, mismatch between server and client expectations.
I don't explain it, and I don't explain why going to https://56qrj.sse.codesandbox.io/fr doesn't suffer from the same issue (works fine there instead)
Maybe something related to how CodeSandbox internally does things?
Anyway, hitting "Restart Sandbox" after changing any file (which causes open ports to close) seems to properly restart the ports (and thus, the app can be used again).
Not such a great dev experience though :/
I'd love some help on the whys and how to fix those issues.
Navigating through the app also caused the ports to be closed. 😢
https://codesandbox.io/s/nrn-v1-hyb-mst-aptd-gcms-lcz-sty-56qrj?file=/README.md
Hey @Vadorequest ,
Sorry that you're having issues, I'll take a look as soon as I can, but at a quick glance, it has all signs of an OOM (out-of-memory) issue. The container the sandbox runs in has a hard memory limit of 1GB, and whenever the devserver goes over this limit, it gets killed and you can experience some unexpected, erratic behavior.
Thanks for the quick feedback.
I can't tell if it's an OOM issue, but my first issues don't seem to be related with OOM ("Error fetching sandbox."). I'm aware this issue has grown big since the first comment, and there is likely multiple related issues underneath.
But OOM could explain why sometimes the server starts correctly and why sometimes it fails.
Yeah, my comment only addressed the second part of yours.
So I took a look at the "Error fetching sandbox.", and it's because we're using a 3rd party service to fetch binary assets (images, fonts etc.), which lately started responding slower and slower. Those fetches have a timeout of 10 seconds, which seems to be reached quite often for your repository, for some reason (maybe it has to do with githack's caching?). I'm working on replacing that with direct raw.githubusercontent.com URLs, will keep you updated.
Ah, that'd definitely explain why it failed until it worked out of the sudden.
Regarding the OOM issue, if that's really the case, is there any workaround? Does some pro plan increases the 1GB limit?
Does some pro plan increases the 1GB limit?
Unfortunately not at the moment.
This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.
@bodganluca Is there any news on this limit?
On Fri, Sep 4, 2020, 14:18 github-actions[bot] notifications@github.com
wrote:
This issue is stale because it has been open many days with no activity.
It will be closed soon unless the stale label is removed or a comment is
made.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/codesandbox/codesandbox-client/issues/4230#issuecomment-687107794,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AA5BRYX6ICIMZMXM4ZIEXSTSEDLJ3ANCNFSM4NNIA3OA
.
We still have the same limit :/
@lbogdan Is it planned to lift the limit at some point in the future?
This issue has automatically been marked stale because there has been no activity in a while. Please leave a comment if the issue has not been resolved, or if it is not stale for any other reason. After 2 weeks, this issue will automatically be closed, unless a comment is made or the stale label is removed.