Description
Describe the bug
Related to #31 because it's the same error, but not because useTranslation
is called in request
hook.
Deploy the reproduction to Vercel and put a ping on it.
I have got uptime kuma calling /api/webhook endpoint every minute. Works fine for about 2 hours and then suddenly
[nuxt] [request error] [unhandled] [500] middleware not initialized, please setup `onRequest` and `onAfterResponse` options of `createApp` with the middleware obtained with `defineI18nMiddleware`
Could be a nuxt/i18n issue.
Edit: no issue on Cloudflare, where I also deployed the same reproduction.
Reproduction
https://github.com/DavidDeSloovere/nuxt-i18n-nitro-issue31
Deploy to Vercel. Call /api/webhook.
System Info
Deployed on Vercel. With Node 22.x
Used Package Manager
pnpm
Additional context
The error can also be thrown just after deployment.
My guess would be that the order in which plugin/middleware/eventhandler get executed isn't correct.
So I would assume it has something to do with cold start and the order of the i18n middleware that is running AFTER the request is being handled.
Log of failed request:
"onRequest" comes AFTER "webhook entered"
Log of working request:
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- The provided reproduction is a minimal reproducible of the bug.