nuxt-modules / i18n

I18n module for Nuxt
https://i18n.nuxtjs.org
MIT License
1.73k stars 479 forks source link

ERROR: middleware not initialized, please setup `onRequest` and `onAfterResponse` options of `createApp` #3176

Open iWatchYouFromAfar opened 2 weeks ago

iWatchYouFromAfar commented 2 weeks ago

Environment


Reproduction

https://stackblitz.com/edit/stackblitz-starters-pphrlk?file=my-module%2Fsrc%2Fmodule.ts

cd my-module
npm i

cd playground
npm i
npm run dev

Describe the bug

I am trying to embed the i18n module into another module and use it in the server middleware. But when using composable useTranslation i get an error:

middleware not initialized, please setup `onRequest` and `onAfterResponse` options of `createApp` with the middleware obtained with `defineI18nMiddleware

I have corrected the error in the link above. What am i doing wrong?

Additional context

No response

Logs

No response

phillipmohr commented 3 hours ago

Same problem here... I'm using it inside a server API route