Skip to content

[App Router] AI search crawlers and TelegramBot miss streaming metadata in Edge SSR #98748

Description

@agentHits

Link to the code that reproduces this issue

https://github.com/agentHits/next.js/tree/fix/seo-monolithic-head-metadata

To Reproduce

  1. Deploy or run an App Router page with asynchronous metadata streaming in Edge SSR runtime.
  2. Send an HTTP request with User-Agent TelegramBot (like TwitterBot), ChatGPT-User, GPTBot, or ClaudeBot.
  3. Read the initial HTML chunk received before the full response streams.

Current vs. Expected behavior

  • Current: Metadata tags (<title>, <meta name="description">, OpenGraph tags) stream in subsequent Suspense chunks. Because HTML-limited bots close the socket after the first chunk, social cards in Telegram and indexing in AI crawlers show empty/missing metadata.
  • Expected: Next.js should recognize these user agents and emit a synchronous, monolithic <head> with all metadata prior to the closing </head> tag.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.2.0
Binaries:
  Node: 24.21.0
  pnpm: 10.33.0
Relevant Packages:
  next: 16.4.0-canary.32
  react: 19.3.0
  react-dom: 19.3.0

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

App Router, Edge Runtime (SSR)

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

next start (production mode)

Additional context

Fix verified with failing/passing test in test/e2e/app-dir/metadata-streaming/metadata-streaming.test.ts and test/unit/is-bot.test.ts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    RuntimeRelated to Node.js or Edge Runtime with Next.js.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions