Next.js Discord

Discord Forum

How can I fix this error message?

Answered
sh1ro posted this in #help-forum
Open in Discord
Avatar
Hello, I'm trying to use next-intl for multiple language function in my next-app. I followed the setup on https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#i18n-routing but keep on getting this error message. How should I set up the function to avoid the error?
Image
Image
Image
Answered by chisto
in the type it has to be Promise<{ locale: string }>

and you have to await it before using it
const locale = (await params).locale
View full answer

10 Replies

Avatar
try
params: Promise<{ locale: string }>
Avatar
@chisto try params: Promise<{ locale: string }>
Avatar
In the type or in the function?
Avatar
in the type it has to be Promise<{ locale: string }>

and you have to await it before using it
const locale = (await params).locale
Answer
Avatar
Okay, lemme try!
Avatar
Asian black bear
I just opened an issue on GitHub to update the docs: https://github.com/amannn/next-intl/issues/1587
And can confirm that chisto is right in what you have to do since this is a new change introduced in Next 15 wherein params are asynchronous.
How can I close this help now?
Avatar
Asian black bear
I did.