I have a problem with Next.JS’s not-found.tsx (using /app)
Here’s the error:
Error: Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `unstable_setRequestLocale` API to enable static rendering
Route /_not-found couldn't be rendered statically because it used `headers
Error occurred prerendering page "/_not-found"my not-found.tsx
import React from "react";import {unstable_setRequestLocale} from "next-intl/server";import {NextIntlClientProvider, useLocale} from "next-intl";
export default function NotFound() { const locale = useLocale(); unstable_setRequestLocale(locale) return ( <NextIntlClientProvider locale={locale}> <span>Not found</span> </NextIntlClientProvider> );};
path to file: src/app/not-found.tsx
I also use [locale]/ folder, for next-intl
You should also know that in “npm run dev”, it works fine, but as soon as I put it into production (via vercel), I get the error above.
Please, help me