-
Notifications
You must be signed in to change notification settings - Fork 26.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serverless out of memory #6301
Comments
Probably because you're adding components and other things to the |
Are you talking about getPageContext, initApollo, theme & withData ? PS : For storybook, I store the stories close to the page, it this also a problem ? |
I meant the storybook files and other components. they all becomes pages. |
I followed your requirements but this issue is still one. I tried with another repo, its working fine (https://github.com/romainquellec/boilerplate). I wil try to add parts to see whats going on. |
This error comes from one broken page. |
@romainquellec could you expand on what solved it? |
I dont really know now. Its seems related to "node-fetch" making a 'CriticalDependencyWarning' with a dynamic import. |
EDIT: I was wrong! Only item * 3 below is right, 1 and 2 can be ignored. I was also experiencing very similar memory leaks in the build process, even though I am not going for the serverless target yet. Both cases seem to be a problem with For future readers, I would recommend trying these:
...
"resolutions": {
"serialize-javascript": "1.6.1"
}, // next.config.js
module.exports = {
webpack(config) {
config.optimization.minimize = false
}
} |
Latest stable has "serialize-javascript": "1.4.0", As you can see in the commits here nothing significant was changed: https://github.com/yahoo/serialize-javascript/commits/v1.6.1
This sounds like a weird recommendation, Next.js already uses Terser.
The would probably work, downside being non-optimized JS. |
you are right! |
I don't think it's a leak btw, it's just using a massive amount of resources to minify your pages 😄 Though I'm very willing to investigate this further, I have some plans for that already 👍 |
@timneutkens any news or ideas on this i can't go production without minification 😢 |
I'm having this same issue, does anyone have tips for finding the culprit file? |
I managed to go around this problem by reviewing my project's structure. In my case, I had too many "supporting files" inside the If you are running out of memory or it's just taking too long to build your app, I recommend double checking that it's not building more pages than needed. In my case, as I wanted to keep my files structure, I had to find a way to flag which files should be compiled as pages and the only way I found to achieve that was using a different extension for them. If you want to achieve the same, these are the steps:
|
Note that it's generally better to move the components out of pages, especially on larger projects. Does the next@canary build output help in showing you that all your components were compiled as pages too? |
@timneutkens Could you clarify? Do you mean importing a single component and exporting it in the page file? |
@stevez86 basically every file in the |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
I'm trying to test and deploy serverless version of nextjs, with serverless framework.
At the build phase, this error below occurs :
To Reproduce
My repo is pretty complex, but should be stable : https://github.com/CuistotduCoin/front
(yarn build)
I will try with a simpler version
System information
The text was updated successfully, but these errors were encountered: