Fix adapter outputs for dynamic metadata routes#91680
Merged
Conversation
Collaborator
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles
Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📎 Tarball URL |
ztanner
reviewed
Mar 20, 2026
| // Dynamic metadata routes (e.g. robots/sitemap using connection()) | ||
| // should remain app routes in adapter outputs. | ||
| const isStaticMetadataRoute = isStaticMetadataFile(normalizedPage) | ||
| const isPrerenderedMetadataRoute = |
Member
There was a problem hiding this comment.
iirc favicon.ico is generated as an APP_ROUTE, so won't this not be in the prerender manifest, and change favicon to not be emitted as a static file?
Member
Author
There was a problem hiding this comment.
We have existing favicon being static test here
next.js/test/production/adapter-config/adapter-config.test.ts
Lines 136 to 141 in 546250e
ztanner
approved these changes
Mar 20, 2026
ijjk
added a commit
that referenced
this pull request
Mar 20, 2026
## Summary This fixes adapter `onBuildComplete` outputs for dynamic metadata routes. ## Bug `handleBuildComplete` skipped metadata routes too aggressively via `isStaticMetadataFile(...)`, so dynamic metadata routes (for example `robots.txt` / `sitemap.xml` using `connection()`) were omitted from `outputs.appRoutes`. ## Fix Only skip metadata routes when they are actually prerendered/static (present in prerender manifests). Dynamic metadata routes are now included in adapter `outputs.appRoutes` as expected. ## Tests Added e2e coverage in `test/e2e/app-dir/adapter-dynamic-metadata`: - verifies dynamic `robots.txt`, `sitemap.xml`, and `favicon.ico` functionality - verifies adapter output classification for non-deploy runs - skips output-shape verification in deploy mode - skips the suite in dev mode
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This fixes adapter
onBuildCompleteoutputs for dynamic metadata routes.Bug
handleBuildCompleteskipped metadata routes too aggressively viaisStaticMetadataFile(...), so dynamic metadata routes (for examplerobots.txt/sitemap.xmlusingconnection()) were omitted fromoutputs.appRoutes.Fix
Only skip metadata routes when they are actually prerendered/static (present in prerender manifests). Dynamic metadata routes are now included in adapter
outputs.appRoutesas expected.Tests
Added e2e coverage in
test/e2e/app-dir/adapter-dynamic-metadata:robots.txt,sitemap.xml, andfavicon.icofunctionality