TypeError: Cannot read property 'req' of undefined
See original GitHub issueVersion
nuxt-i18n: 6.11.1 nuxt: 2.11.0
Nuxt configuration
[mode]
- [ x ] universal
Nuxt-i18n configuration
i18n: {
strategy: 'prefix_except_default',
locales: [
{ code: 'en', file: 'en.json' },
{ code: 'de', file: 'de.json' }
],
defaultLocale: 'en',
vueI18n: {
fallbackLocale: 'en'
},
lazy: true,
langDir: 'i18n/',
detectBrowserLanguage: {
useCookie: true,
cookieKey: 'i18n_redirected',
fallbackLocale: 'en'
}
}
Steps to reproduce
Try to invoke localeLink
function on $root
on SSR. Like
const { $root } = this;
$root.localePath(...)
What is Expected?
Path is generated properly.
What is actually happening?
Getting TypeError.
It is known issue been discussed in ticket https://github.com/nuxt-community/nuxt-i18n/pull/596
And the PR was merged, but now looks like it has been reverted…
In a nutshell, on SSR $root
instance $ssrContext
should be replaced by ssrContext
.
Issue Analytics
- State:
- Created 3 years ago
- Comments:12
Top Results From Across the Web
Express.js Cannot read property 'req' of undefined
My Express. js app has been throwing Cannot read property 'req' of undefined . In essence, it listens for a GET request, grab...
Read more >Cannot read property req body undefined in express - YouTube
codercrab #express #body-parserCannot read property req body undefined in express ||Express req body is undefined for post requests.
Read more >TypeError: Cannot read property 'req' of undefined · Issue #711
Error that I described is happening only client-side, so I am guessing that it caused by destroyed component. All reactions.
Read more >TypeError: Cannot read property 'send' of undefined : NodeJs
The error is occurring because req.body is undefined . You need to configure Express to parse JSON request bodies. You can do this...
Read more >getting "TypeError: Cannot read property 'quote' of undefined ...
getting "TypeError: Cannot read property 'quote' of undefined" The terminal shows the error at app.js 22:23. const express = require('express'); ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you are using vue-composition-api plugin it’s because root’s $ssrContext is undefined. It’s moved to the context.ssrContext. I am not sure if the same case happens to non CAPI scenarios
Apologies, I think I accidentally confused this with vue-i18n itself, in which they have added support for capi if I’m not mistaken.