Open XEngine opened 1 year ago
same "Dynamic Server Usage: cookies" issue during next build
.
What worked for me is to mark static pages as "force-static"
. Maybe you should try it.
// app/static-page/page.tsx
export const dynamic = "force-static";
export default function SomeStaticPage() {
return //...
};
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true)
Link to the code that reproduces this issue or a replay of the bug
I cant make a reproduction rn
To Reproduce
use headers() or cookies() or searchParams parameter from page.js files inside server components or utilities called by server controllers
Describe the Bug
This occures whenever I used next server side functions inside server componets, like If I call a "headers()" function to get the request headers inside page.js, I am facing with the issue. This issue however is not a stopper. Next works as intented, it's completly functional. But strangely it prints these errors.
When I used those functions and npm run build. In sentry this is what I see:
Another Dynamic Server Usage error is, when I try to dynamic import of a component with
{ssr: false}
parameter. I does render the component, component works as intented but when I try to view source of the page this is what I seeExpected Behavior
I don't know. Maybe these are not errors, not even warnings but informations. Any info about it?
Which browser are you using? (if relevant)
Chrome 113.0.5672.127
How are you deploying your application? (if relevant)
custom server