Skip to content

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

Open
@Gul7333

Description

@Gul7333

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

[email protected] 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

[email protected] 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Dynamic RoutesRelated to dynamic routes.create-next-appRelated to our CLI tool for quickly starting a new Next.js application.dynamicIORelated to dynamicIO.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions