Closed alexcroox closed 3 months ago
Would you be able to provide a reproduction? π
Would you be able to provide a reproduction? π
it's this line here, should I be adding the issue on the intlify/h3 repo instead?
https://github.com/intlify/h3/blob/main/src/index.ts#L355
That line is calling the line in this repo that expects the second param:
You could open an issue on the other repository but we will need a (minimal) reproduction of your issue to determine whether this is caused by configuration or a bug.
Closing due to inactivity and lack of minimal reproduction.
Hi @alexcroox, were you able to resolve this issue, i am experiencing similar behaviour intermittently.
Unfortunately not. It happens consistently on my login endpoint the very first time I submit after a page reload. After that first usage it doesnβt happen again. Very confused
If you could create a reproduction I can reopen this and take a look at it π
@temitopeadesoji I found a workaround, set lazy: false
in nuxt.config and the error will not occur:
export default defineNuxtConfig({
i18n: {
lazy: false,
}
})
This is because the loadAndSetLocaleMessgaes()
function that tries to use an undefined i18nContext
is never called if you don't use lazy.
Not ideal from a performance point of view, but it will get rid of the fatal error for now.
@BobbieGoede I'll try get a reproduction together, but the issue is around i18nContext being undefined at times.
I tried to reproduce but failed to, still trying to work out what's the flow my full app uses that's causing issues.
Environment
Reproduction
Passing an H3 event from an API eventHandler to a function in the server/utils directory causes this error:
Cannot read properties of undefined (reading 'messages')
Describe the bug
My function where the error originates:
Looking at the stack trace at the bottom I think I've manage to figure out why it's erroring with this.
Firstly the localeDector is called here with 1 param (event)
This seems to be calling this localeDetector function which requires the
i18nContext
context as it's second param.Which is why this line fails:
await loadAndSetLocaleMessages(locale, localeLoaders, i18nContext.messages);
because i18nContext is undefined.
Additional context
No response
Logs
No response