Next.js Discord

Discord Forum

Issue with limit of connection pools when building big static generated app

Unanswered
Sharp-tailed Sandpiper posted this in #help-forum
Open in Discord
Avatar
Sharp-tailed SandpiperOP
Hi all,

I have been on this this whole afternoon. I have an app using Prisma and postgre, with tons of pages created at built time with data fetched from various queries.

My database limit the number of connection, let's say I have a pool size of 15.
Every time I try to build my app, I reach that size and some pages fails to generate.

The build time looks stateless so I can't control the instances of Prisma being used, and even if I try to reduce the connection limit, looks like Next will try to create more and more "threads" to generate the pages if I limit the number of connection per instance of Prisma which makes me reach the limit again.

Is there any configuration or documentation that I missed on how I could control the build time of my ssg pages to avoid reaching that limit and force the build to wait until some connections are free again? Like a max concurrency for static generation or something?

I saw staticGenerationMaxConcurrency on version 15c, I'm not even sure this might help me fix this but it's not available on v14.

Thanks! Anything would help

1 Reply

Avatar
Sharp-tailed SandpiperOP
I'll give a cookie to anyone that can help 🥹