Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
iWatchYouFromAfar opened this issue Oct 11, 2024 · 1 comment

Comments

@iWatchYouFromAfar
Copy link

iWatchYouFromAfar commented Oct 11, 2024

Environment


  • Operating System: Linux
  • Node Version: v18.20.3
  • Nuxt Version: ^3.13.0
  • CLI Version: 3.14.0
  • Nitro Version: -
  • Package Manager: [email protected]
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants