Skip to content

Next Js Project fails to build while using cached components and routes with params #7913

@Pmacdon15

Description

@Pmacdon15

Preliminary Checks

Reproduction

https://github.com/Pmacdon15/minimal

Publishable key

pk_test_Y2hlZXJmdWwtc3dpZnQtNDQuY2xlcmsuYWNjb3VudHMuZGV2JA

Description

Steps to reproduce:

  1. Init Next js Project
  2. Install Clerk
  3. Setup middleware/proxy and provider
  4. Create route with params ```/route/[id]/page.tsx`
  5. Turn on cachedComponents in next config
  6. run build

Expected behavior:

build to run with out errors.

Actual behavior:

build failed with this error:

Error: Route "/test-route/[id]": Uncached data or `connection()` was accessed outside of `<Suspense>`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route
    at RootLayout (src/app/layout.tsx:28:5)
  26 | }>) {
  27 |   return (
> 28 |     <ClerkProvider>
     |     ^
  29 |       <html lang="en">
  30 |         <body
  31 |           className={`${geistSans.variable} ${geistMono.variable} antialiased`}
 GET /test-route/2 200 in 806ms (compile: 695ms, proxy.ts: 15ms, generate-params: 308ms, render: 96ms)
 POST /test-route/2 200 in 78ms (compile: 56ms, prox

Environment

Packages: +1
+
Progress: resolved 1, reused 0, downloaded 1, added 1, done

  System:
    OS: Linux 6.18 Arch Linux
    CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-1260P
    Memory: 6.39 GB / 15.31 GB
    Container: Yes
    Shell: 5.3.9 - /usr/bin/bash
  Binaries:
    Node: 24.11.1 - /home/pmacd/.local/share/mise/installs/node/24.11.1/bin/node
    Yarn: 1.22.22 - /home/pmacd/.local/share/mise/installs/node/24.11.1/bin/yarn
    npm: 11.6.2 - /home/pmacd/.local/share/mise/installs/node/24.11.1/bin/npm
    pnpm: 10.28.0 - /home/pmacd/.local/share/mise/installs/node/24.11.1/bin/pnpm
    bun: 1.3.9 - /home/pmacd/.local/share/mise/installs/bun/1.3.9/bin/bun
  Browsers:
    Chromium: 145.0.7632.109
  npmPackages:
    @biomejs/biome: 2.2.0 => 2.2.0 
    @clerk/nextjs: ^6.38.2 => 6.38.2 
    @tailwindcss/postcss: ^4 => 4.2.1 
    @types/node: ^20 => 20.19.33 
    @types/react: ^19 => 19.2.14 
    @types/react-dom: ^19 => 19.2.3 
    babel-plugin-react-compiler: 1.0.0 => 1.0.0 
    next: 16.1.6 => 16.1.6 
    react: 19.2.3 => 19.2.3 
    react-dom: 19.2.3 => 19.2.3 
    tailwindcss: ^4 => 4.2.1 
    typescript: ^5 => 5.9.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageA ticket that needs to be triaged by a team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions