FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

These are effectively saying “Your build ran out of memory”. Node doesn’t handle that super well, in terms of “ok let me try scaling back” but instead just charges forward and eventually your build fails.

You’ll need to reduce memory usage. You need to aim for approximately 3Gb maximum for reliable builds. You’ll sometimes have more (depending on the number of other builds running simultaneously, which you have no control over or visibility into), but that’s the amount you can rely on and into which your build should fit on our Starter and Pro teams.

Enterprise teams have available custom build resources, where runtime, CPU, and memory available are adjustable.

In the case of gatsby @szokrika, it is likely that you use a poorly behaved plugin such as the ones mentioned in #5 in this article: 5 pro-tips and plugins for optimizing your Gatsby + Netlify site , so the fix for you may be as easy as finding the offending module and choosing not to use it.

Without more details such as a link to your build logs, @BrunoQuaresma, I couldn’t give you any similarly specific information since I don’t know what you’re using to build.

1 Like