[BUG] Base URL changes introduce static rendering bug
Author: robertDouglassCreated May 18, 2025Updated May 18, 2025
Is there an existing issue for this?
- I have searched the existing issues
Vercel Runtime Logs
- I have checked the Vercel Runtime Logs for errors (if applicable)
Current Behavior
The recent addition dynamic base url detection server side introduces an optimization bug whereby NextJS is not able to load the models during static rendering. This bug doesn't seem to affect functionality but it is a performance regression. I'm currently researching alternative approaches.
✓ Collecting page data
Failed to load models: Error: Dynamic server usage: Route / couldn't be rendered statically because it used `headers`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error
at y (.next/server/chunks/243.js:19:10449)
at m (.next/server/chunks/622.js:10:26147)
at o (.next/server/chunks/253.js:1:40526)
at n (.next/server/chunks/253.js:1:39524)
at o (.next/server/app/page.js:1:9867)
at stringify (<anonymous>) {
description: "Route / couldn't be rendered statically because it used `headers`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error",
digest: 'DYNAMIC_SERVER_USAGE'
}
All attempts to load models failed, returning empty arrayExpected Behavior
Static rendering of models during build time.
Steps To Reproduce
bun run build
Environment
bun run buildAnything else?
No response
Source: miurla/morphic