Nuxt.js: nuxt generate fails with a lot of dynamic routes

Created on 8 Feb 2017  ·  8Comments  ·  Source: nuxt/nuxt.js

npm run generate was working great, until I added bunch of dynamic routes and it seems to be too heavy for it to generate? There are random times where the ms is "3-4" and if I check the folder it's empty, also npm run generate doesn't really ever finish it throws because it fails to retrieve from the api inside the data method (it's local and always returns 202 no really any api issues)

screen shot 2017-02-08 at 21 56 09

Here is the error (it's fixed data so I always expect to find the name)
screen shot 2017-02-08 at 22 02 42

It might be that the express server hangs? that will be totally weird I tested it while generate is running always working, it happens with routes that have data method:
````

````

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

Most helpful comment

20 000 static HTML page 😱

Amazing 🙌

All 8 comments

When launching nuxt generate, the server is not working so it might be the error.

Can you try to launch your server with nuxt dev and in another tab of your terminal nuxt generate?

@Atinux of course I'm running the server there is issues with the generation script. the image shows that some routes work and some dont. They all have ssr data method.

It's weird since our website https://github.com/nuxt/nuxtjs.org is also generated and most of the pages are with asynchronous data with API call.

The problem might come from you API call http://localhost:3000/api/airport/${slug} which does not return the airport data.

Try to debug it with:

data({ params, error }) {
    const slug = params.slug;
    return axios.get(`http://localhost:3000/api/airport/${slug}`)
    .then((res) => {
      console.log('Data returned', res.data)
      return {
        airport: res.data.airport,
      };
    }).catch((err) => {
      console.log('Error returned', err)
      error({ statusCode: 404, message: 'Countries page not found' })
    });
  }

And try to run your server + nuxt generate and see what's displayed please.

I will double check but it's not the first time I generate the static files
it started to happen after i went past the 10's to 10,000s of pages. I will
try to debug this one in more detail.

On 9 Feb 2017 12:00 a.m., "Sébastien Chopin" notifications@github.com
wrote:

It's weird since our website https://github.com/nuxt/nuxtjs.org is also
generated and most of the pages are with asynchronous data with API call.

The problem might come from you API call http://localhost:3000/api/
airport/${slug} which does not return the airport data.

Try to debug it with:

data({ params, error }) {
const slug = params.slug;
return axios.get(http://localhost:3000/api/airport/${slug})
.then((res) => {
console.log('Data returned', res.data)
return {
airport: res.data.airport,
};
}).catch((err) => {
console.log('Error returned', err)
error({ statusCode: 404, message: 'Countries page not found' })
});
}

And try to run your server + nuxt generate and see what's displayed
please.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/nuxt/nuxt.js/issues/221#issuecomment-278490693, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AEPpqo2if94Iqd7tvoIz0IuvGLkRdedxks5rakjvgaJpZM4L7XQu
.

It seems to work now after removing a big json return from the API and returning just what's needed also it went down from 250ms per generate to 20ms, I guess I probably chocked it with so much data (2,000 items array) or i had wrong slug somewhere over there was able to generate it successfully thanks a lot! nuxt is awesome! ~20,000 static html pages 👍

20 000 static HTML page 😱

Amazing 🙌

i have the same problem, i want use nginx , no any node.js server, that's possible?

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pehbehbeh picture pehbehbeh  ·  3Comments

uptownhr picture uptownhr  ·  3Comments

vadimsg picture vadimsg  ·  3Comments

nassimbenkirane picture nassimbenkirane  ·  3Comments

vadimsg picture vadimsg  ·  3Comments