UNHANDLED EXCEPTION write EPIP with Gatsby build

I’m having the same issue on a relatively small blog type site I administer for a friend that uses NetlifyCMS, Gatsby and builds and deploys on Netlify.

It’s fine on v4.6.2 but the build fails every time when updated to v4.9.2.

I’ve added my details to an open Gatsby Github issue:

Sticking with v4.6.2 for now.

1 Like

thank you, i hope the gatsby folks can take a look at this soon :grimacing:

I’m having same problem today (3/12/2022).
Gatsby CLI 4.9.1, Gatsby 4.9.3.
Just upgraded from v3 (which I built and deployed earlier today).
V3 and V4 build fine on my machine.
I DO NOT have any Netlify packages explicitly in my package.json, but that was never a problem before.
I’m about to try adding GATSBY_CONCURRENT_DOWNLOAD to 16 in the Netlify env vars.

GATSBY_CONCURRENT_DOWNLOAD to 16 in Netlify Env vars did not work either.
BTW, ran with Retry Deploy, Clear Cache

@j-e-clark Thanks! Rolled back to v4.6.2 and it works now.
I removed the netlify env var: GATSBY_CONCURRENT_DOWNLOAD to 16 before build.
package.json:
“gatsby”: “4.6.2”,
“gatsby-cli”: “^4.0.0”,

Thanks so much for updating this thread and sharing your solution! It is very beneficial for future members who encounter the same error, so we appreciate it!

Happy building :rocket:

guys, a few days ago I updated from gatsby from gatsby 4.7.2 to 4.9.1 without any issue, only sometimes I had the EPIPE error but after redeploying it was resolved, but today almost every deploy fails! So I tried almost everything:
adding GATSBY_CONCURRENT_DOWNLOAD variable to 16
GATSBY_CPU_COUNT to 1
optimizing images
disabling WEBP
Rolled back to 4.7.2

Any ideas? something bad is going on today with netlify?

Hey there, @npg :wave:

Thanks for reaching out! Sorry to hear you are experiencing difficulties.

When you say you have tried optimizing images, can you elaborate on that? My first thoughts here would be checking your source images to see if you can reduce their size. Have you addressed the size of source images yet?

hey @npg ,
Were you able to get this issue resolved? I’m facing the same issue. Tried everything but nothing seems to work.

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:

If there are other questions, please let us know.

Sorry detosk, the solution, for now, is downgrade to 4.7, refactoring as they suggest is not the solution.

1 Like

@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.

1 Like

totally agree, we are thinking of moving our website to another service because of this problem, they should fix it or they will lose many customers

Hey there, folks!

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.

1 Like

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.

1 Like

Yes. This seems to have completely resolve the issue for me.

2 Likes

Thanks for coming back and letting us know, @witcradg. Happy building!

Thanks for your work on this.

I upgraded to v4.13.1 today and have now had multiple successful builds and no failures.

2 Likes

Hi @ascorbic we seem to be hit by this issue (reported here: Gatsby v4 Builds suddenly killed, exit code 137 - #17 by slashdata) but unfortunately in our case migrating from Gatsby v2 to v4 is not at option in the short term (due to the workload involved)

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.