Skip to content

bug: Cannot generate static page #2006

Open
@DawnMD

Description

@DawnMD

Provide environment information

  System:
    OS: macOS 15.0.1
    CPU: (8) arm64 Apple M2
    Memory: 89.05 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.9.0 - ~/Library/Caches/fnm_multishells/23543_1730102638399/bin/node
    npm: 10.2.5 - ~/Library/Caches/fnm_multishells/23543_1730102638399/bin/npm
    pnpm: 9.4.0 - ~/Library/Caches/fnm_multishells/23543_1730102638399/bin/pnpm

Describe the bug

Pages are not generated statically when prefetching in a page or directly in a layout. If we remove all prefetch (be it await or void) then pages are generated statically.

Its mostly an issue when fetching some data from a CMS, as prefetch all or each the data from CMS will be a good way to render page statically

Tried to use next 15's static page symbol after upgrading, there also no static page symbol is showing when prefetching at the page/layout

Reproduction repo

https://github.com/t3-oss/create-t3-app

To reproduce

  1. Scaffold the app with
    • App router
    • tRPC
    • Tailwind
  2. Update the build script with --debug
  3. You'll get Static generation failed due to dynamic usage on /, reason: headers

Additional information

With prefetch at page level
image

Without prefetch
image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions