question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'iso' of undefined

See original GitHub issue
IMPORTANT: Please use the following link to create a new issue:

https://nuxtjs.cmty.io/issues/new?repo=nuxt-community%2Fnuxt-i18n

If your issue was not created using the app above, it will be closed immediately.

^ I am not handing this site a token for my github account.

i’m getting the error

Cannot read property 'iso' of undefined

i’d like to know which iso you are using there is es of the iso and es-ES

soooooo which is it.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15

github_iconTop GitHub Comments

1reaction
rchlcommented, Feb 26, 2019

I’ve looked a bit at the code.

With default strategy (prefix_except_default), with two pages: index.vue and about.vue, these routes are generated:

    routes: [{
      path: "/en/about",
      component: _33ee994b,
      name: "about___en"
    }, {
      path: "/jp/about",
      component: _33ee994b,
      name: "about___jp"
    }, {
      path: "/en/",
      component: _53a67410,
      name: "index___en"
    }, {
      path: "/jp/",
      component: _53a67410,
      name: "index___jp"
    }],

As there is no /about route being generated, the whole redirection logic fails because it can only redirect from existing routes due to needing route’s name to properly resolve current route and route to redirect to.

The behavior is slightly different whether it’s first redirect in the app or subsequent. On first it will redirect from unknown route to index. After that, when cookie is already set, it will just fail with error above (unless alwaysRedirect: true I guess).

It’s IMO also buggy that on first redirect it will redirect to index. It should probably just trigger 404 if it can’t figure out which route to redirect to.

One way to fix it would potentially be to add code to resolve route by path. If user visits non-existing route like /about, we would add defaultLocale prefix and try to resolve by path. But then when user visits /xx/about, maybe we should strip the ‘xx’ prefix and then add default locale. Not sure how smart it would need to be.

BTW. The root issue seems to stem from bad redirection logic but it would be easy to foolproof the code that is failing (in seo-head.js) to not fail in this case.

1reaction
gnuletikcommented, Oct 23, 2018

@begueradj You probably missed to encapsulate the module in an array. You can find more details on the issue here: https://github.com/nuxt-community/google-adsense-module/issues/13#issuecomment-397820366

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'iso' of undefined · Issue #80 - GitHub
One way to fix it would potentially be to add code to resolve route by path. If user visits non-existing route like /about...
Read more >
Getting cannot read properties of undefined error when trying ...
The problem in your code is map is returning an array of promise instead of data. You can do sth like this:
Read more >
NFS ISO: Cannot read property 'Export' of undefined - XCP-ng
Running the latest openSUSE Leap 15.4 as my IT Workstation to manage both my XCO-ng servers, etc,... and my NFS exports file look...
Read more >
Options - i18n-module
Here are all the options available when configuring the module and their default values:
Read more >
Re: [dc.js users] Cannot read property 'getFullYear' of null
I keep getting the message error "Cannot read property 'getFullYear' of null" coming from the d3.js file: Here is the html code (index.html):....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found