Errors generating dynamic routes

Hello,

I’m struggling with generating dynamic routes.
My webstite (under construnction) : https://lacramee.netlify.app

It’s an ecommerce website using WooCommerce API. I have a strucure like this in my page products
pages > products > _category > _product
an exemple is : products/bags/amsterdam.

It works perfectly in dev, but when I generate, some of those routes are not generated (not all of them, I don’t understand why). Besides, I can have access of all of the pages in the deployed site, but when I refresh a page product, i have a 404.

There an exemple of an error when i generate :


It’s often a 500, but sometimes I have a 503 on specific route (with no apparent logic).

I use v2.15.7, so I don’t have to use property generate route according to the doc. I still tried it (with axios request and even hard coding) but it didn’t work.

The thing is I don’t understant the logic of the crawler and the errors I got.

Thank you for your help!

Hi @Charles

Welcome to the Netilfy forums :netliconfetti:

I do not see an Amsterdam in the bags section. I do see one in the Plant Hangers section (/products/plant_hangers/amsterdam).

While I did not click every link on the site (I clicked a lot though) I did not see any errors—all products rendered correctly. Can you specify a route that isn’t generated?

Netlify’s CDN serves the path (file) requested. If the routes you are rendering are dynamic there is no file to serve so it returns a 404. You may need to add

/*      /index.html      200

to a _redirects file in the static directory to overcome this issue.

Netlify documentation suggests setting Nuxt to target: static. These routes should (depending on your code) get generated at build time.

Hi @coelmay ,

Thank you for your quick answer.
Of course it makes sense for the 404 page. I put the _redirects file, it works perfectly.

In fact as I said, I have access to all the pages, BUT I have a lot of errors when I generate

about 90% of all the dynamic pages.

So why those errors while it’s all good on my deployed site? I want to correct it because I think it’s not a good thing for building/deploying performance.

The answer would lie with the API you’re trying to connect to as they’re the ones sending a 500. You need to try and log the cause of failure or ask them for logs which might be helpful.