Upgrade to Gatsby 5 causing build failures because of Gatsby Cache

Ok so some context on this first.
We had to migrate to Netlify when Gatsby Cloud was sunset.
We have been running on Netlify for over 6 months now and after some teething issues everything has been working fine.

We have recently upgraded to Gatsby 5 which has been causing problems with build failures.
I found a separate forum post regarding Netlify’s enforced installation of the gatsby-adapter-netlify causing problems with builds on v5.12 and above. So we enforced v5.11 to resolve this issue.

However we started seeing build failures for every contentful change.

Looking into this further there seemed to be a conflict with the cached files and the build with various errors on graphql missing pages etc.

Our set up was to gatsby build to take advantage of the cache and speed up the builds.
We have put a temporary fix in place now so that we gatsby clean and then gatsby build for every content push.

This is not an ideal solution though as the build times have increased by 2 minutes per build.

So my questions are:

What is wrong with the way Gatsby/Netlify is handling the cache?
Is this a known error?
What is the solution to get this working again so we can see better build speeds for our content editors?

Many thanks

1 Like

We need a site to check anything before commenting.

@hrishikesh https://www.ellenmacarthurfoundation.org many thanks.

You’ve got many successful deploys: Netlify App (probably because you’re using the clean && build command. Could you point us to a deploy that failed? I found one on the first page, but that seems to have failed in spite of not using cache, so seems irrelevant here.

Hi Hrishikesh

Yes we added the gatsby clean because that solved the odd cache issue. The last failing build was 65675d1b4e8401000811ade3 on the Nov 29 at 11:50 AM

The fix was then put in place to use gatsby clean on all builds and the first build after was 65675d1b4e8401000811ade3 Nov 29 at 3:47 PM

The error indicates a graphql error but this is not the case. No errors building locally and building clean after clearing the cache. So it is the cache that is causing the issue. And this only started happening after implementing Gatsby 5.

Thanks

Mark