Why my API route.ts is statically rendered ? #62725
-
SummaryI have an API route I found a workaround by adding
and became
This way, it works fine. My route is dynamically rendered. The Fetch requests are cached, but I can simply add { cache: "no-store" } if I don't want it to be cached. The fact that I "use" the request object (with Additional informationNo response ExampleNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi You should be able to just do
The first link talks about ways to opt-out from the caching, which is the default behavior. The last option listed is called route segment config, and there you'll find the second link, which talks about controlling this via the You could also activate the Next.js TypeScript plugin, https://nextjs.org/docs/app/building-your-application/configuring/typescript#typescript-plugin, and that'll give you auto-complete when working with |
Beta Was this translation helpful? Give feedback.
Hi
You should be able to just do
export const dynamic = 'force-dynamic'
anywhere in the file.The first link talks about ways to opt-out from the caching, which is the default behavior. The last option listed is called route segment config, and there you'll find the second link, which talks about controlling this via the
dynamic
export.You could also activate the Next.js TypeScript plugin, https://nextjs.org/docs/app/building-your-application/configuring/typescript#typescript-plugin, and that'll give y…