[recovery] fix: setRequestLocale ordering in [...slug] generateMetadata (static→dynamic error)#18800
Open
pettinarip wants to merge 1 commit into
Open
[recovery] fix: setRequestLocale ordering in [...slug] generateMetadata (static→dynamic error)#18800pettinarip wants to merge 1 commit into
pettinarip wants to merge 1 commit into
Conversation
✅ Deploy Preview for ethereumorg ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
The catch-all [locale]/[...slug] generateMetadata never called
setRequestLocale before invoking next-intl APIs. getMdMetadata ->
getMetadata calls getTranslations("common"), and the catch block also
calls getTranslations("common"). Without setRequestLocale, next-intl
reads the locale from request headers for on-demand slugs, opting the
route into dynamic rendering and throwing "Page changed from static to
dynamic at runtime ... reason: headers".
Observed in production via /images/videos/Clw-qf1sUZg.jpg, which maps to
the catch-all with locale="images".
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6478b4a to
dc9c0cd
Compare
Contributor
🔎 First-pass review — ✅ Looks mergeableSingle-line fix adding Analysis
|
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.

Production error
grafana-fn-error-page-changed-from-static-to-dynamic-at-runtime-images-videos-clw-qfnsu[ERROR] ⨯ Error: Page changed from static to dynamic at runtime /images/videos/Clw-qf1sUZg.jpg, reason: headersget requestLocale(next-intl).Root cause
/images/videos/Clw-qf1sUZg.jpghas no static asset and falls through to the catch-allapp/[locale]/[...slug]/page.tsxwithlocale="images",slug=["videos","Clw-qf1sUZg.jpg"](a bot/broken-link probe against a YouTube-ID-shaped path).generateMetadatain that route never calledsetRequestLocale(locale)before invoking next-intl APIs:getMdMetadata→getMetadatacallsgetTranslations("common")(src/lib/utils/metadata.ts:66);catchblock also callsgetTranslations("common").Without
setRequestLocale, next-intl falls back to reading the locale from requestheaders()for on-demand slugs (those not covered bygenerateStaticParams), which opts the route into dynamic rendering and throws "Page changed from static to dynamic at runtime … reason: headers".Fix
Add
setRequestLocale(locale)at the top ofgenerateMetadata, before any next-intl call. Same class of fix as #18785 (videos slug), #18797 (wallets), #18798 (resources).Verification
pnpm type-check✅pnpm exec eslinton changed file ✅🤖 Generated with Claude Code