# Nuxt generate with dynamic route empty datas on first load

**URL:** <https://answers.netlify.com/t/nuxt-generate-with-dynamic-route-empty-datas-on-first-load/11433>\
**Category:** Support\
**Tags:** building, deployment\
**Created:** [March 31, 2020, 2:58am UTC](https://answers.netlify.com/t/nuxt-generate-with-dynamic-route-empty-datas-on-first-load/11433 "2020-03-31T02:58:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![f3ltron](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/f3ltron/32/17107_2.png) [@f3ltron](https://answers.netlify.com/u/f3ltron)\
**Post date:** [March 31, 2020, 2:58am UTC](https://answers.netlify.com/t/nuxt-generate-with-dynamic-route-empty-datas-on-first-load/11433/1 "2020-03-31T02:58:41Z")

</div>

What i have ?

- a nuxt app [https://github.com/vuemontreal/vuemontreal/tree/vuemontreal-next](https://github.com/vuemontreal/vuemontreal/tree/vuemontreal-next)

- i am using npm run generate with dynamic routes.

- when i am looking locally my app i have html with datas

- my netlify app [https://vuemontreal.netlify.com/](https://vuemontreal.netlify.com/)

- on first load i have no datas… on every pages. But after i navigate my data come.

ps:

- 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

---

<div class="post-metadata">

**Author:** ![jen](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/jen/32/6044_2.png) [@jen](https://answers.netlify.com/u/jen)\
**Post date:** [April 3, 2020, 12:15am UTC](https://answers.netlify.com/t/nuxt-generate-with-dynamic-route-empty-datas-on-first-load/11433/2 "2020-04-03T00:15:56Z")

</div>

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!

> **[Our API Documentation Journey with Nuxt.js, Netlify, and Github](https://www.storyblok.com/tp/api-documentation-storyblok-nuxt-js-netlify-and-github#why-fetch-instead-of-asyncdata)**
>
> After two years of closed and automated documentation writing we've got so many requests of developers that want to contribute to our documentation by providing examples, adding query parameter descriptions, or fixing a typo that we...

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

---

<div class="post-metadata">

**Author:** ![f3ltron](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/f3ltron/32/17107_2.png) [@f3ltron](https://answers.netlify.com/u/f3ltron)\
**Post date:** [April 3, 2020, 1:07am UTC](https://answers.netlify.com/t/nuxt-generate-with-dynamic-route-empty-datas-on-first-load/11433/3 "2020-04-03T01:07:20Z")

</div>

```
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](https://fr.nuxtjs)

 ![netlify](https://global.discourse-cdn.com/netlify/original/2X/1/199e2f4918ef1941218d53dcf32f222b62e3435d.png) .org/api/configuration-generate/

---

<div class="post-metadata">

**Author:** ![f3ltron](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/f3ltron/32/17107_2.png) [@f3ltron](https://answers.netlify.com/u/f3ltron)\
**Post date:** [April 3, 2020, 3:48pm UTC](https://answers.netlify.com/t/nuxt-generate-with-dynamic-route-empty-datas-on-first-load/11433/4 "2020-04-03T15:48:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jen](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/jen/32/6044_2.png) [@jen](https://answers.netlify.com/u/jen)\
**Post date:** [April 6, 2020, 8:57pm UTC](https://answers.netlify.com/t/nuxt-generate-with-dynamic-route-empty-datas-on-first-load/11433/5 "2020-04-06T20:57:40Z")

</div>

Our logs do show that this route, for example, was generated on our side via a deploy yesterday:  
`/fr/events/002-implementing-vue-js-in-legacy-code/index.html`

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

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:

> **[Creating Dynamic Routes in a Nuxt Application | CSS-Tricks](https://css-tricks.com/creating-dynamic-routes-in-a-nuxt-application/#article-header-id-1)**
>
> In this post, we’ll be using an ecommerce store demo I built and deployed to Netlify to show how we can make dynamic routes for incoming data. It’s a fairly

Could you either export just the routes [here](https://github.com/vuemontreal/vuemontreal/blob/master/configs/generate.js#L38) or make a more specific call [here](https://github.com/vuemontreal/vuemontreal/blob/6f71ccf9c48d9d2db2d6d4f0402257e1801e6b24/nuxt.config.js#L15) within `generate` so it’s something like :

```auto
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?

---

<div class="post-metadata">

**Author:** ![f3ltron](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/f3ltron/32/17107_2.png) [@f3ltron](https://answers.netlify.com/u/f3ltron)\
**Post date:** [April 6, 2020, 9:45pm UTC](https://answers.netlify.com/t/nuxt-generate-with-dynamic-route-empty-datas-on-first-load/11433/6 "2020-04-06T21:45:44Z")

</div>

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 🙂
