Detail pages goes 404 in prod
Answered
Purple Finch posted this in #help-forum
Purple FinchOP
I have an application that I listed in the article. I list all articles on /articles. I go to the detail page with /article/[slug]. I do not receive any errors on the detail pages when working locally, but when I deploy, the detail pages become 404. (I don't think there is an error in the API endpoint because I do not receive any errors in /articles when the website is live, the data is listed) I have added the pictures of my code below. my next version is "13.4.19"
Answered by riský
how deferent is
article.data and article.attributes... as you are getting static params with article.slug and article.attributes.slug for actually geting the page and metadata8 Replies
Purple FinchOP
also my file structure
how deferent is
article.data and article.attributes... as you are getting static params with article.slug and article.attributes.slug for actually geting the page and metadataAnswer
also, you should put the not found function in the metadata as its done first (one less query/render needed)
i think a issue is the inconsistency you have:
* fetching data (metadata is deferent from others - getting by id vs filter)
* if getting the list of articles, getting the post is deferent
* fetching data (metadata is deferent from others - getting by id vs filter)
* if getting the list of articles, getting the post is deferent
something you can do for testing is console log the articles list, the param, and the found value of article
and when you say you tested localy, have you tried production local (next build && next start)
Purple FinchOP
@riský in generateStaticParams, I sent the wrong json data in the returned slug value. When I did 
article.attributes.slug the error was fixed. Thank you very much 
yeah i could tell one of those were the issue