cloudflare/vinext

App Router: metadata streaming protocol (slow-to-body, dedup, UA rules, bot 307) not implemented

已关闭

#1,451 创建于 2026年5月22日

 (0 条评论) (0 个反应) (0 位负责人)TypeScript (384 个派生)github user discovery
adapter-api-e2ehelp wanted

仓库指标

星标
 (8,625 个星标)
PR 合并指标
 (平均合并 1天 1小时) (30 天内合并 462 个 PR)

描述

This issue was created by an agent analysing CI failures from the Next.js Deploy Suite (vinext main vs Next.js v16.2.6, 2026-05-22).

Problem

vinext's metadata renderer does not implement the streaming variant of the App Router metadata protocol. Specifically: (1) slow metadata is not delayed and emitted into <body> (it appears in <head> instead, or is duplicated); (2) metadata.streamingMetadata UA rules that should disable streaming for headless-browser bots are not respected; (3) html-limited bot user agents that hit a server-component redirect() should receive a blocking HTTP 307, but vinext returns 200 because the streaming path swallows the redirect.

delay the metadata render to body: Expected: 0 Received: 1 (head)
dynamic api: render metadata to body Expected: 0 Received: 1
should load the initial html without slow metadata during navigation: Expected: "slow page" Received: "index page"
should send streaming response for headless browser bots: Expected: 0 Received: 1
html limited bots access redirect: Expected: 307 Received: 200

Estimated Impact

~8 test failures across the deploy suite.

Affected Test Suites

  • test/e2e/app-dir/metadata-streaming/metadata-streaming.test.ts (7 failures)
  • test/e2e/app-dir/metadata-streaming/metadata-streaming-customized-rule.test.ts

Recommendation

  1. Reproduce first in vinext's own test suite. Add tests for (a) slow generateMetadata being rendered into <body> rather than <head>, (b) a custom UA rule disabling streaming for headless bots, (c) a redirect inside generateMetadata returning 307 for an html-limited bot UA. Confirm each fails.

  2. Study Next.js metadata streaming. Search .nextjs-ref/packages/next/src/server/app-render/metadata.tsx and related files for the streaming protocol: when metadata is split between head and body, the bot detection table, and the redirect-blocking logic.

  3. Implement streaming, dedup, UA rules, and redirect blocking. Stream slow metadata into <body> with a deduplication marker, respect metadata.streamingMetadata rules to disable streaming for specific UAs, and emit a blocking 307 when an html-limited bot hits a redirect() inside metadata.

  4. Add coverage for parallel routes and edge runtime. Confirm the streaming path works alongside #1341 (parallel-routes metadata) and the edge runtime path that owns vary headers.

贡献者指南