Home

Issue: 1503

Error on directly accessing a dynamic route in the browser

[issue link]

Hi,

I use the latest version of nuxt (rc6) with the @nuxtjs/pwa module

I have a typical cateogry/_slug.vue page.

on that page, I have a simple created() method that gets the this.$route.params.slug variable and fetches the content from a static javascript array in the Store (No API call).

I can navigate to that page without any problem when clicking on a classic link in the app.

But when I try to access the page directly through the browser. example : http://localhost:3000/category/blog

I get a 500 Error, saying Cannot read property 'slug' of null,
either on running npm run dev and npm run start

I tried replacing created() with beforeMount(), mounted(). And I still get the same error.

I have no clue on what is going on there. Is someone facing the same problem ?

Thanks a lot for your help, in advance !

This question is available on Nuxt.js community (#c1338)