App Router: metadata streaming protocol (slow-to-body, dedup, UA rules, bot 307) not implemented
#1451 aperta il 22 mag 2026
Metriche repository
- Star
- (8563 stelle)
- Metriche merge PR
- (Merge medio 1g 1h) (462 PR mergiate in 30 g)
Descrizione
This issue was created by an agent analysing CI failures from the Next.js Deploy Suite (vinext
mainvs Next.jsv16.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
-
Reproduce first in vinext's own test suite. Add tests for (a) slow
generateMetadatabeing rendered into<body>rather than<head>, (b) a custom UA rule disabling streaming for headless bots, (c) a redirect insidegenerateMetadatareturning 307 for an html-limited bot UA. Confirm each fails. -
Study Next.js metadata streaming. Search
.nextjs-ref/packages/next/src/server/app-render/metadata.tsxand related files for the streaming protocol: when metadata is split between head and body, the bot detection table, and the redirect-blocking logic. -
Implement streaming, dedup, UA rules, and redirect blocking. Stream slow metadata into
<body>with a deduplication marker, respectmetadata.streamingMetadatarules to disable streaming for specific UAs, and emit a blocking 307 when an html-limited bot hits aredirect()inside metadata. -
Add coverage for parallel routes and edge runtime. Confirm the streaming path works alongside
#1341(parallel-routes metadata) and the edge runtime path that ownsvaryheaders.