Build Failed - Body exceeded 50000kb limit

Hello,
I use server-side generation intensively in my project. It currently generates 31335 static pages.
Until today, the number was ca. 15000 and I haven’t had any such problems. But now I introduced another language, so the number of pages doubled. Now I am getting this error “Build Failed - Body exceeded 50000kb limit“.
From the error message, it’s not clear what exactly is causing the problem. The build log is not helpful. It reaches the step “Deploying outputs..“ and then this error comes.
Is there a limit on how many pages can be statically generated? On the Limits page, I don’t see any such limit. Can anybody explain what the real issue is?

This is an internal limitation for build size

We do not recommend pre-rendering 30K static pages, as this will linearly increase all build times (you appear already to be approaching the half hour mark for a build)

Instead, move page compilation out of the build process, which means you no longer have to deploy to update content nor will build time scale along with the size of your content library

The easiest solution is to use Incremental Static Regeneration (ISR) to create a persistent content cache across builds that you can revalidate at any time

1 Like

Hi @jacobparis ,

thanks for the info.

I am aware of the drawbacks of generating so many static pages on build. My website has a page for every major city in the world, for multiple languages. That combination makes it reach such numbers easily. The first-hit page performance is very important to me due to SEO reasons. Therefore I prefer SSG to ISG (although I employ ISR for smaller cities of course).

I guess my main question is, what exactly is this limit and why it’s not documented anywhere. I want to know the exact limit, so I can develop the most appropriate mitigation strategy myself (decrease the number of statically generated city pages, decrease the number of languages, upgrading my plan, etc.)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.