Vercel ISR Problem: Excessive CMS Requests

Hi, @ya2s! Welcome to the Vercel Community :wave:

For large-scale Next.js applications using ISR on Vercel with too many pages to specify in getStaticPaths, you could consider implement on-demand revalidation, i.e. use res.revalidate() in an API route to update specific pages when your CMS content changes, rather than invalidating all pages at once.

Or generate only the most important or frequently accessed pages at build time, and use fallback: 'blocking' for the rest:

export async function getStaticPaths() {
  const mostImportantSlugs = await fetchMostImportantSlugs()
  return {
    paths: mostImportantSlugs.map((slug) => ({ params: { slug } })),
    fallback: 'blocking',
  }
}

Another approach would be to implement caching strategy to serve stale content while revalidating in the background, reducing the immediate load on your CMS.

Let us know how you get on!

Also wanted to share this ISR post recently for anyone passing by :smiley: