Next.js Discord

Discord Forum

[solved] - Unable to find `next-intl` locale on middleware

Answered
Willow Ptarmigan posted this in #help-forum
Open in Discord
Willow PtarmiganOP
Hi,
I'm trying to find an error in NextJs with next-intl.
I don't understand what's wrong with this error.

Here is my middleware.ts located in src/middleware.ts : https://prnt.sc/syHJQ49Z7vt8
Here is the layout.tsx located in src/app/[locale]/layout.tsx: https://prnt.sc/HRh4POYFB23-

The build went well, sometimes vercell it still throws the error:
Error: Unable to find next-intl locale because the middleware didn't run on this request. See https://next-intl-docs.vercel.app/docs/routing/middleware#unable-to-find-locale

I tried their middleware, and same error...
Answered by Willow Ptarmigan
i forgot to make the function in the layouts.tsx as async.
Then the problem was solved.
View full answer

9 Replies

Willow PtarmiganOP
Yes, i don't know how i managed to fix it
@Willow Ptarmigan Yes, i don't know how i managed to fix it
Mini Satin
Could you share the matcher in middleware?
Willow PtarmiganOP
yes..sorry . i was gone
navigator
/src/app/[locale]/layout.tsx
the problem was in layout.tsx
Willow PtarmiganOP
i forgot to make the function in the layouts.tsx as async.
Then the problem was solved.
Answer