Skip to content

Occasional error with useTranslation on Vercel #43

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

Open
5 tasks done
DavidDeSloovere opened this issue Feb 27, 2025 · 0 comments
Open
5 tasks done

Occasional error with useTranslation on Vercel #43

DavidDeSloovere opened this issue Feb 27, 2025 · 0 comments
Labels
status: review needed Request for review

Comments

@DavidDeSloovere
Copy link
Contributor

DavidDeSloovere commented Feb 27, 2025

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"
Image

Log of working request:

Image

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.
@DavidDeSloovere DavidDeSloovere added the status: review needed Request for review label Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: review needed Request for review
Projects
None yet
Development

No branches or pull requests

1 participant