π§ When generateMetadata
is async, nextjs puts metadata in the body
on first render.
#78688
Labels
Headers
Related to the async headers() function.
π¦ Link to the code that reproduces this issue
https://github.com/bschmeisser-stytch/cupcake-auth-nextjs
ποΈ To Reproduce
npm run dev
META CHECK β
body
not thehead
π€ Current vs. Expected behavior
head
taggenerateMetadata
are placed in thebody
tagπ» Provide environment information
Node.js v22.13.0 Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:40 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6031 Available memory (MB): 36864 Available CPU cores: 14 Binaries: Node: 22.13.0 npm: 10.9.2 Yarn: 1.22.22 pnpm: N/A Relevant Packages: next: 15.3.1 // Latest available version is detected (15.3.1). eslint-config-next: 15.3.1 react: 19.1.0 react-dom: 19.1.0 typescript: 5.8.3 Next.js Config: output: N/A
π Which area(s) are affected? (Select all that apply)
Headers
π¦ Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local)
π΅ Additional context
π Local Fix
I was able to fix this internally by removing all async in the method. I was able to make an async call in the background and cache the values. For example:
π΅ Here's the tamper monkey script.
The text was updated successfully, but these errors were encountered: