nextjs - 💡(How to fix) Fix Dev-only RangeError in App Router async traversal when large Prisma MSSQL query resolves (~10k rows) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#87772Fetched 2026-04-08 02:06:13
View on GitHub
Comments
0
Participants
1
Timeline
7
Reactions
1
Author
Participants
Timeline (top)
labeled ×4unlabeled ×2issue_type_added ×1

Error Message

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>)

Code Example

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>)

---

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/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/aliameur/next-prisma-rangeerror-repro

To Reproduce

  1. Install deps (pnpm install)
  2. Create mssql db (docker compose up -d)
  3. Push prisma schema and seed (pnpm prisma:push && pnpm prisma:seed)
  4. Start the application in development (pnpm dev)
  5. Visit / or /full to 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/A

Which 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

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.

extent analysis

TL;DR

Downgrade to Next.js version "v15.4.2-canary.16" to avoid the recursion failure in the development App Router runtime.

Guidance

  • Verify the issue is specific to the MSSQL Prisma adapter by testing with the PostgreSQL Prisma adapter, which is reported to work fine.
  • Check the stack trace to confirm the infinite recursion occurs within the visitAsyncNode function in next/dist/compiled/next-server/app-page-turbo.runtime.dev.js.
  • Consider testing with a smaller dataset to see if the issue is related to the size of the data being retrieved from the database.
  • Review the changes introduced in "v15.4.2-canary.17" to understand the potential cause of the regression.

Example

No specific code changes are suggested at this time, as the issue appears to be related to a regression in the Next.js development App Router runtime.

Notes

The issue is specific to the development environment and does not affect production builds or API routes. The recursion failure is also specific to the MSSQL Prisma adapter.

Recommendation

Apply the workaround by downgrading to "v15.4.2-canary.16" until a fixed version is available, as this version is reported to work fine and avoids the recursion failure in the development App Router runtime.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING