Builds Failing From Contentful Netlify App Using Gatsby

We are migrating our site from Gatsby Cloud to Netlify.

I have set up the Netlify App in Contentful to fire builds when content changes are made.

However I have continual failing builds when Netlify tries to build the site using this method.

If I build the site manually from the Netlify UI it builds fine. If it builds from contentful content changes more often than not the build fails. Not everytime but more often than it is successful.

The error coming up in the build log is normally the same and can happen at different times but usually after

success Caching Webpack compilations - 0.001s

The first part of the error states:

1:06:12 PM: Killed
1:06:12 PM: error Command failed with exit code 137. (https://ntl.fyi/exit-code-137)
1:06:12 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
1:06:12 PM: ​
1:06:12 PM: build.command failed                                        
1:06:12 PM: ────────────────────────────────────────────────────────────────
1:06:12 PM: ​
1:06:12 PM:   Error message
1:06:12 PM:   Command failed with exit code 137: yarn build (https://ntl.fyi/exit-code-137)
1:06:12 PM: ​
1:06:12 PM:   Error location
1:06:12 PM:   In Build command from Netlify app:
1:06:12 PM:   yarn build
1:06:12 PM: ​
1:06:12 PM:   Resolved config

Followed by the config list and redirects list. Then states:

1:07:03 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
1:07:02 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:07:02 PM: Failing build: Failed to build site
1:07:03 PM: Finished processing build request in 4m35.086s

Which doesn’t really shed any light on why it has failed other than user error.

Is there anyway to trace what has actually broken the build here so I can have something more concrete to go on rather than user error?

Oh ps it also after failing hangs on the Cleanup process.

Hi would you mind sharing the site name/slug on your account that’s failing to build?