Skip to content

[BUG] Page router next/head component not working for SSR pages #571

@hcentelles

Description

@hcentelles

Describe the bug

When the Page Router next/head component is used on SSG or dynamic (SSR) pages the html that came from the server did not have the meta tags that the component should add.

The meta tags are added later (on hydration phase I suppose), if I inspect the page in the devtools Elements tab I can verify it.

On static pages it works ok.

Steps to reproduce

  1. Clone this reproduction repo created with the npm create cloudflare@latest -- my-next-app --framework=next --platform=workers command: https://github.com/hcentelles/my-next-app
  2. Install deps: npm i
  3. Run the app with the "native" nextjs server: npm run build && npm run start
  4. Download the html of the SSG example page: curl -o ssg-nextjs.html http://localhost:3000/ssg
  5. Kill the nextjs server Ctrl+C
  6. Run the app with the opennext preview command: npm run preview
  7. Download the html of the SSG example page: curl -o ssg-opennext.html http://localhost:8787/ssg
  8. Compare both files to verify that in ssg-nextjs.html exist the <title data-next-head="">SSG Example</title> tag but in ssg-opennext.html do not exist.

Expected behavior

I would expect the <title data-next-head="">SSG Example</title> tag to be in ssg-opennext.html too.

@opennextjs/cloudflare version

1.0.0-beta.2

Wrangler version

4.10.0

next info output

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:23 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T8122
  Available memory (MB): 24576
  Available CPU cores: 8
Binaries:
  Node: 20.12.1
  npm: 10.5.0
  Yarn: 1.22.19
  pnpm: N/A
Relevant Packages:
  next: 15.2.5 // There is a newer version (15.3.0) available, upgrade recommended! 
  eslint-config-next: N/A
  react: 19.1.0
  react-dom: 19.1.0
  typescript: N/A
Next.js Config:
  output: N/A
 ⚠ There is a newer version (15.3.0) available, upgrade recommended! 
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
   Read more - https://nextjs.org/docs/messages/opening-an-issue

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions