Skip to content

[BUG] Base URL changes introduce static rendering bug #544

@robertDouglass

Description

@robertDouglass

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 array

Expected Behavior

Static rendering of models during build time.

Steps To Reproduce

bun run build

Environment

bun run build

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions