Skip to content

[BUG] cacheComponents: true permanent "Connection closed" error with blank static shell served #1225

@mahalrs

Description

@mahalrs

Describe the bug

When cacheComponents: true is enabled in next.config.ts (Next.js 16.2.4), the OpenNext Cloudflare only serves static shell (static pages and Suspense fallbacks) without streaming the dynamic content inside suspense. This results in all pages being permanently broken and the browser throws Error: Connection closed.

Related to #1115

Steps to reproduce

  1. Create a Next.js 16.2.4 app with cacheComponents: true
  2. Have an async Server Component wrapped in <Suspense>:
async function StreamedContent() {
  const user = await getUser() // async operation
  return <div>user.name</div>
}

export default function Page() {
  return (
    <div>
      <div>
          Some content...
      </div>
      <Suspense fallback={<div>Loading...</div>}>
          <StreamedContent />
      </Suspense>
    </div>
  )
}
  1. Build and deploy with @opennextjs/cloudflare
  2. Page shows blank static shell with "Some content..." and "Loading..." but the actual <StreamedContent/> never renders in the browser. Browser throws Error: Connection closed.

Expected behavior

  1. The cached static shell should be sent as the first chunk of a streaming response, rendering "Some content..." and "Loading...".
  2. The Worker should then initiate dynamic rendering for the Suspense boundaries and render the <StreamedContent/> showing user name.
  3. The browser receives the Suspense fallback HTML but never gets resolution data
  4. The browser throws Error: Connection closed when the response stream ends
  5. The page remains stuck on the loading fallback permanently

@opennextjs/cloudflare version

1.19.1

Wrangler version

4.83.0

next info output

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:41 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T6000
  Available memory (MB): 32768
  Available CPU cores: 10
Binaries:
  Node: 24.9.0
  npm: 11.6.0
  Yarn: 1.22.19
  pnpm: 10.17.0
Relevant Packages:
  next: 16.2.4 // Latest available version is detected (16.2.4).
  eslint-config-next: N/A
  react: 19.2.5
  react-dom: 19.2.5
  typescript: 5.9.3
Next.js Config:
  output: N/A

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions