Nuxt generate with dynamic route empty datas on first load

What i have ?


  • At the beginning i thought it could be because of the new fetch api from nuxt but even with asyncData it’s not working.

I have no ideas… I love your app help me please i don’t know how to check the result of the build

Thank’s for your time

Hey there,
I took a look at your logs and I don’t see any error messages there- your site is building and deploying correctly on Netlify. I’m not a Nuxt expert, but some places I would start debugging would be:

  • confirm that you’re generating your event routes & content during build. Could you try console.logging the generated routes to ensure they’re created?
  • check why you’re not currently fetching when the page loads- you’re only fetching on input or click. Can you render (or make API calls if necessary) as part of the loading process instead?

Sharing this walkthrough in case it’s useful for you!

Let us know if we can answer any other questions on this or if you find a fix!

i Generating pages
√ Generated /fr/404
√ Generated /en/404
√ Generated /404
√ Generated fr/events/005-atelier-d-introduction-a-nuxtjs
√ Generated fr/events/004-inner-workings-of-a-javascript-framework
√ Generated fr/events/008-strategies-de-tdd-pour-tester-vos-applications-vuejs
√ Generated fr/events/006-vueconf-toronto-2019-the-best-of
√ Generated fr/events/003-atelier-nightclazz-introduction-a-vue-js
√ Generated fr/events/002-implementing-vue-js-in-legacy-code
√ Generated fr/events/001-vuejs-montreal-premiere-edition-introduction-a-vuejs
√ Generated en/events/008-strategies-de-tdd-pour-tester-vos-applications-vuejs
√ Generated en/events/006-vueconf-toronto-2019-the-best-of
√ Generated en/events/004-inner-workings-of-a-javascript-framework
√ Generated en/events/005-atelier-d-introduction-a-nuxtjs
√ Generated en/events/002-implementing-vue-js-in-legacy-code
√ Generated en/events/003-atelier-nightclazz-introduction-a-vue-js
√ Generated en/events/001-vuejs-montreal-premiere-edition-introduction-a-vuejs
√ Generated /fr/search
√ Generated /search
√ Generated /en/search
√ Generated /fr/
√ Generated /en/
√ Generated /
i Generating sitemaps
√ Generated /sitemap.xml

That’s my generated files. all my dynamics routes are in events/*

As you can see with my image. The dist is create and you can see files with datas. Is it possible to see the generated files in the netlify server ? Or maybe i miss something in nuxt config ? Because normally we have nothing to do.

I am using the new fetch api with the new nuxt version. And it’s like async data when building locally so maybe the calls not working on your server ? Maybe the env variable are not working i dont know

The doc about nuxt generate https://fr.nuxtjs


Can we have logs if it call the api or not in my generate file ?

It look that my routes are not generated dynamically like it never call the api…

locally all is working well i just don’t know what to do

Our logs do show that this route, for example, was generated on our side via a deploy yesterday:

Maybe you’ve gotten things working in that case!? Fingers crossed :slight_smile:

If not, I wonder if the issue could have to do with how your routes parameter is nested in your Nuxt config. This shows a working routes parameter:

Could you either export just the routes here or make a more specific call here within generate so it’s something like :

generate: {
  routes: require('./configs/generate').generate.routes

Since you’re generating the sitemap the same way, I’m wondering if that is working for you or not?

It’s look like I didn’t have access to one variable and nuxt generate just didn’t work but now all is working fine :slight_smile:

1 Like