Hi, @detosk. An out of memory error (OOM) is typically only able to be resolved by refactoring the code to use less memory during the site build or by using more memory.
Our support team cannot assist with refactoring third-party code as that is outside our scope of support. For getting more memory, you can either upgrade to an Enterprise plan and add the High-Performance Build add-on or you can build locally and use the CLI tool to upload the local builds using the manual deploy process:
@Luke It seems a shame that Netlify’s build memory limit is only 3GB on the ‘Business’ plan, compared to Gatsby Cloud’s ‘Professional’ plan, which gives you an 8GB limit. Gatsby v4 now uses parallel processing during builds to speed things up, resulting in higher memory usage - which is great, but means it’s impossible to build a medium-sized site now on Netllify, as you very quickly can hit the 3GB memory limit. We’ve had to switch a client’s site over to Gatsby Cloud solely because of this Netlify shortcoming.
Bottom line: for medium-sized sites, Netlify does not support Gatsby v4 without the High Performanace Builds add-on, but at $1500 a month per site that’s simply not a sensible option, particularly when Gatsby Cloud gives you a higher build memory limit for just $50 a month. I love Netlify, and would much rather keep all our sites on your framework-agnostic service than start migrating sites over to Gatsby Cloud, but we may have no other choice if Netlify don’t rethink it’s approach to memory limitations. Is there any way you can escalate this issue? I’m sure we’re not the only agency who would consider this a showstopper.
Thanks for following up here and taking the time to share that feedback. I have shared your thoughts internally with all of the relevant teams and I want to assure you that our engineers are looking into this.
Additionally, @chocobuckle, I see you mention that you’re an agency, please do keep in mind that agencies can speak with our Sales about offerings that can fit your business needs. You can follow this link here to see more.
Hello! I’m really happy to say we have a fix for this. It turns out it was not a memory issue after all, but was a bug in Gatsby. It doesn’t appear when building locally because most people are using multi-core machines and the bug only appears when using a single worker. We worked with the Gatsby team to release a fix which went out today. If you update your site to gatsby@4.13.1 then it should fix the problem.
Given that the issue seems to be related to the use of single core when building I was wondering if Netlify could provide the option of using multi-core in order to bypass this issue?
That was more specific to Gatsby 4 - I’m not sure if it’s relevant to Gatsby 2. Also, when using Gatsby 4, the solution is to reduce the CPU count to 1 to ensure stable builds with low memory consumption - not the other way round.