-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Open
Labels
Error HandlingRelated to handling errors (e.g., error.tsx, global-error.tsx).Related to handling errors (e.g., error.tsx, global-error.tsx).RuntimeRelated to Node.js or Edge Runtime with Next.js.Related to Node.js or Edge Runtime with Next.js.TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.WebpackRelated to Webpack with Next.js.Related to Webpack with Next.js.
Description
Link to the code that reproduces this issue
https://github.com/aliameur/next-prisma-rangeerror-repro
To Reproduce
- Install deps (
pnpm install) - Create mssql db (
docker compose up -d) - Push prisma schema and seed (
pnpm prisma:push && pnpm prisma:seed) - Start the application in development (
pnpm dev) - Visit
/or/fullto reproduce the error
Current vs. Expected behavior
When resolving a Prisma MSSQL query returning ~10,000 rows inside a Server Component, next dev crashes with a stack overflow inside the App Router dev runtime.
I expect the page to render correctly, instead it gives this error
RangeError: Maximum call stack size exceeded
at Map.has (<anonymous>)
⨯ unhandledRejection: RangeError: Maximum call stack size exceeded
at Map.has (<anonymous>)
⨯ unhandledRejection: RangeError: Maximum call stack size exceeded
at Map.has (<anonymous>)
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:35:32 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6020
Available memory (MB): 16384
Available CPU cores: 10
Binaries:
Node: 22.18.0
npm: 10.9.3
Yarn: 1.22.22
pnpm: 10.11.0
Relevant Packages:
next: 16.1.1 // Latest available version is detected (16.1.1).
eslint-config-next: N/A
react: 19.2.3
react-dom: 19.2.3
typescript: 5.9.3
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
Error Handling, Webpack, Turbopack, Runtime
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
I tested my repro against different canary versions, and this behaviour was introduced in "v15.4.2-canary.17", "v15.4.2-canary.16" works fine
Additional context
- Reproducible locally using next dev on macOS (and Docker MSSQL backend)
- Deployment environment doesn’t matter, since the issue only happens in the development App Router runtime
- Works correctly in:
- next build && next start (production)
- API routes
- standalone Node scripts
- Issue is database-driver-specific:
- PostgreSQL Prisma adapter: works fine
- MSSQL Prisma adapter: triggers the crash
- Regression observed:
- v15.4.2-canary.16 works fine
- v15.4.2-canary.17 introduces the recursion failure in visitAsyncNode
- Current stable also exhibits the bug
- Verified using Chrome inspector and stack traces:
- Infinite recursion happens inside the dev runtime file:
next/dist/compiled/next-server/app-page-turbo.runtime.dev.js - Specifically within the function named visitAsyncNode
- Infinite recursion happens inside the dev runtime file:
Based on stepping through the dev runtime with Chrome inspector, the recursion loop occurs before any data is rendered, while dev traversal is visiting async nodes created from the MSSQL request resolution.
Metadata
Metadata
Assignees
Labels
Error HandlingRelated to handling errors (e.g., error.tsx, global-error.tsx).Related to handling errors (e.g., error.tsx, global-error.tsx).RuntimeRelated to Node.js or Edge Runtime with Next.js.Related to Node.js or Edge Runtime with Next.js.TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.WebpackRelated to Webpack with Next.js.Related to Webpack with Next.js.