Gatsby 4 deploy fails - The function "__DSG" is larger than the 50MB limit. Please consider reducing it

We’ve just upgraded our site to Gatsby 4 and it builds and deploys without issue on our staging instance on Gatsby Cloud. On deploying to Netlify today the build fails with the following errors:

1:01:19 PM: The function “__SSR” is larger than the 50MB limit. Please consider reducing it.
1:01:20 PM: The function “__DSG” is larger than the 50MB limit. Please consider reducing it.

Our site is large and as far as I know we have no control over the contents of these .zip files. How we resolve this issue? We use Gatsby functions so can’t disable all Gatsby functions.

Hi @tim-line,

You’d have to work to reduce the number of pages that go in the DSG bundle or reduce the overhead used by some Node Modules. If you’re having any other resources like images, it’s worth stripping those off too.

There’s this guide for Next.js Functions:

which could be relevant to Gatsby too.