Error generating static pages - DYNAMIC_SERVER_USAGE #1062
Replies: 3 comments 4 replies
-
It might be because Next.js doesn't allow dynamic routes within layouts that use Options to solve this:
|
Beta Was this translation helpful? Give feedback.
-
hi @amannn i came here and i see what you suggest but i do not understand how to solve it. i am in need for "output: 'export'"
how do i have to configure it to work with the mentioned i tried to move the mentioned generateStaticParms from
|
Beta Was this translation helpful? Give feedback.
-
I had the same issue and I solved it by adding unstable_setRequestLocale(locale); thi si my code:
|
Beta Was this translation helpful? Give feedback.
-
Hi!
I currently have:
and
on my
[locale]/layout.tsx
file.But when i try to build im getting the following error on most of my pages:
description: "Route /en/account 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'
I'm NOT using
unstable_setRequestLocale
on the pages that it's giving error since this comment #663 (comment) said i do not need it in"use client"
pages.Also these pages have the information of the user and should be dynamic.
My questions are: Should i ignore this errors and move on (the build seems to run correctly although the errors on the console)? Am i doing the right approach here? Should i remove the
generateStaticParams
and go full dynamic?Thanks!
PS: i use this approach for the titles of the pages: i create a
layout.tsx
on each page. Is this the correct approach as well?Beta Was this translation helpful? Give feedback.
All reactions