Error: read ECONNRESET - GatsbyJS - Netlify Builds

Good day,

We have a GatsbyJS eCommerce site that uses a WordPress/WooCommerce backend.

To build the front-end, we use the gatsby-source-wordpress plugin.

Very often, we get the error “Error: read ECONNRESET”. After spending hours debugging, I seemed to have narrowed it down to a specific setting on Cloudflare.

When going to Firewall → Settings → Security Level and changing it to “Essentially Off”, the error seems to go away completely. However, when this setting is medium or high, the above-mentioned error occurs.

It seems that something is resetting the connection as a security feature. During compiles on Netlify, the backend is hit with a lot of API calls to the /graphql endpoint. Sometimes the error happens when doing API calls and sometimes it happens when downloading images.

Has anyone else experienced a similar issue?

Thanks
Chris