nextjs - 💡(How to fix) Fix Incorrectly triggered "missing Suspense boundary" error during build using Cache Components, Proxy with next-auth, and useSearchParams() [5 comments, 2 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#85951Fetched 2026-04-08 02:13:16
View on GitHub
Comments
5
Participants
2
Timeline
14
Reactions
1
Timeline (top)
commented ×5subscribed ×4labeled ×2mentioned ×2

Error Message

3. Observe Error

Error occurred prerendering page "/auth/partner-signin"

  • Build fails with misleading error message
  • Error says to add Suspense boundary, but multiple boundaries already exist
  1. Acceptable outcome: If there's a specific pattern required, the error message should explain:
  • Error is misleading because Suspense boundaries are already present

Root Cause

  • Error is misleading because Suspense boundaries are already present
  • Similar routes without the proxy work fine
  • The proxy pattern is documented in Next.js multi-tenant examples

Code Example

git clone <this-repo>
cd usesearchparams-suspense
pnpm install

---

pnpm next build --debug-prerender

---

Render in Browser should be wrapped in a suspense boundary at page "/auth/partner-signin"
Error occurred prerendering page "/auth/partner-signin"

---

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:30 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6020
  Available memory (MB): 16384
  Available CPU cores: 12
Binaries:
  Node: 22.16.0
  npm: 11.6.2
  Yarn: 1.22.19
  pnpm: 10.20.0
Relevant Packages:
  next: 16.0.1 // Latest available version is detected (16.0.1).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  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/alexanderbnelson/usesearchparams-suspense-proxy

To Reproduce

1. Clone and Install

git clone <this-repo>
cd usesearchparams-suspense
pnpm install

2. Run Build

pnpm next build --debug-prerender

3. Observe Error

⨯ Render in Browser should be wrapped in a suspense boundary at page "/auth/partner-signin"
Error occurred prerendering page "/auth/partner-signin"

Current vs. Expected behavior

Current Behavior

  • Build fails with misleading error message
  • Error says to add Suspense boundary, but multiple boundaries already exist
  • No clear guidance on what's actually wrong

Expected Behavior

One of the following should happen:

  1. Best outcome: Next.js should recognize that:

    • The route has proper Suspense boundaries
    • The route uses useSearchParams() and should be dynamic
    • The route should skip prerendering automatically
  2. Acceptable outcome: If there's a specific pattern required, the error message should explain:

    • What's wrong with the current Suspense setup
    • Which Suspense boundary is missing or incorrect
    • How to fix it

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:30 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6020
  Available memory (MB): 16384
  Available CPU cores: 12
Binaries:
  Node: 22.16.0
  npm: 11.6.2
  Yarn: 1.22.19
  pnpm: 10.20.0
Relevant Packages:
  next: 16.0.1 // Latest available version is detected (16.0.1).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

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

Middleware, cacheComponents

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

next build (local)

Additional context

  • Error is misleading because Suspense boundaries are already present
  • Similar routes without the proxy work fine
  • The proxy pattern is documented in Next.js multi-tenant examples

extent analysis

TL;DR

  • The issue can be resolved by adjusting the Suspense boundary setup or configuring Next.js to skip prerendering for dynamic routes using useSearchParams().

Guidance

  • Review the Suspense boundary implementation in the /auth/partner-signin page to ensure it correctly wraps the component tree, focusing on the interaction with useSearchParams().
  • Verify if the next.config.js file contains any custom configurations that might interfere with the default prerendering behavior for dynamic routes.
  • Consider adding a custom getStaticProps method to the affected page to explicitly control prerendering, potentially returning { fallback: 'blocking' } to handle dynamic routes.
  • Check the Next.js documentation for the latest guidance on using useSearchParams() with Suspense boundaries and prerendering, as the behavior might have changed between versions.

Example

// Example of wrapping a component with a Suspense boundary
import { Suspense } from 'react';

function PartnerSignin() {
  // Component implementation using useSearchParams()
}

function PartnerSigninPage() {
  return (
    <Suspense fallback={<div>Loading...</div>}>
      <PartnerSignin />
    </Suspense>
  );
}

Notes

  • The provided error message suggests a misunderstanding in the Suspense boundary setup, but the presence of multiple boundaries complicates the issue.
  • The use of useSearchParams() indicates the route is dynamic and might require special handling during prerendering.

Recommendation

  • Apply workaround: Adjust the Suspense boundary setup and consider configuring getStaticProps to control prerendering behavior, as the current error message does not clearly indicate a straightforward fix.

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