Skip to content

Cannot build with dynamicIO enabled. #8897

@revnelson

Description

@revnelson

Describe the Bug

When enabling the experimental dynamicIO feature, the following error occurs during build:

Error occurred prerendering page "/admin/[[...segments]]". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Route "/admin/[[...segments]]" has a `generateMetadata` that depends on Request data (`cookies()`, etc...) or external data (`fetch(...)`, etc...) but the rest of the route was static or only used cached data (`"use cache"`). If you expected this route to be prerenderable update your `generateMetadata` to not use Request data and only use cached external data. Otherwise, add `await connection()` somewhere within this route to indicate explicitly it should not be prerendered.
Export encountered an error on /(payload)/admin/[[...segments]]/page: /admin/[[...segments]], exiting the build.

While this is experimental, the documentation for the new 'use cache' directive states that it aims to replace the unstable_cache API.

Given that we will be using the payload client directly in Server Actions, we will need a way to cache those actions with tags (for revalidateTag). React's cache doesn't support tagging for manual revalidation, which leaves only Next's unstable_cache and 'use cache' with cacheTag as options.

Link to the code that reproduces this issue

blank

Reproduction Steps

Enable experimental dynamicIO feature.

Build.

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

Payload: beta-119
Node: 20
Next.js: 15.0.2-canary.9

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions