vercel / vercel/next.js

Collecting page data .[RangeError: Maximum call stack size exceeded], static export can handle only limites pages

Open
#80,032 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Cache Components create-next-app Dynamic Routes
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/Gul7333/urdudictinory/actions/runs/15373691466/job/43256067868

To Reproduce

i have next js project which uses nextjs static export , the problem is my sttaic export is litle large like 100k+ pages , these pages are simple , when i build only 5000 pages it work but when i build full sttaic pages it fails

as this static param generte function work as i am slicing only 5000 pages

export function generateStaticParams() {
const slugs = dictionaryData.slice(0,5000)
.filter((item) => item && item[1]) // Filter out null/undefined and missing index
.map((item) => ({
slug: item[1],
}));
return slugs
}

but when i remove slice

// export const revalidate = 60
export function generateStaticParams() {
const slugs = dictionaryData.slice(0,5000)
.filter((item) => item && item[1]) // Filter out null/undefined and missing index
.map((item) => ({
slug: item[1],
}));
return slugs
}

it gives this errro
npm run build

urdudictinory@0.1.0 build
next build

▲ Next.js 15.3.2

  • Environments: .env

Creating an optimized production build ...
✓ Compiled successfully in 60s
Skipping linting
✓ Checking validity of types
Collecting page data .[RangeError: Maximum call stack size exceeded]

Build error occurred
[Error: Failed to collect page data for /word/[slug]] { type: 'Error' }

Current vs. Expected behavior

i have next js project which uses nextjs static export , the problem is my sttaic export is litle large like 100k+ pages , these pages are simple , when i build only 5000 pages it work but when i build full sttaic pages it fails

as this static param generte function work as i am slicing only 5000 pages

export function generateStaticParams() {
const slugs = dictionaryData.slice(0,5000)
.filter((item) => item && item[1]) // Filter out null/undefined and missing index
.map((item) => ({
slug: item[1],
}));
return slugs
}

but when i remove slice

// export const revalidate = 60
export function generateStaticParams() {
const slugs = dictionaryData.slice(0,5000)
.filter((item) => item && item[1]) // Filter out null/undefined and missing index
.map((item) => ({
slug: item[1],
}));
return slugs
}

it gives this errro
npm run build

urdudictinory@0.1.0 build
next build

▲ Next.js 15.3.2
Environments: .env

Creating an optimized production build ...
✓ Compiled successfully in 60s
Skipping linting
✓ Checking validity of types
Collecting page data .[RangeError: Maximum call stack size exceeded]

Build error occurred
[Error: Failed to collect page data for /word/[slug]] { type: 'Error' }

Provide environment information
ubuntu 
Next.js 15.3.2
Which area(s) are affected? (Select all that apply)

Dynamic Routes, dynamicIO, create-next-app

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked GitHub Actions run and the /word/[slug] route, then inspect generateStaticParams and compare the 5,000-page and full-list cases. Run npm run build with Next.js 15.3.2; done means the cause of the stack overflow is isolated and the full static export either succeeds or has a documented, reproducible limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, next.js
Domain
build-system, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.