404 code on working page
Unanswered
Siamese Crocodile posted this in #help-forum
Siamese CrocodileOP
Hello everyone! I'm writing this post today because I've been experiencing a strange behavior on my Next.js 14.1.4 project for several weeks now.
I've built a Next.js application that displays content from a WordPress blog via API calls. However, I've noticed that sometimes certain pages of my app return a 404 status code, even though the content DISPLAYS CORRECTLY. And to fix this, I have no choice but to redeploy my application.
My current hypothesis is that this error occurs after deployment. When a page's cache updates through revalidation, it tries to retrieve page information via the WordPress API. But if the API doesn't function properly and returns an invalid format, I call the notFound() function, causing the page to become a 404. However, what I don't understand is that during the next successful cache revalidation, my Next.js app regenerates the page correctly but does not update the status code. Do you have any ideas? If so, I'd love to hear them! 😄
I've built a Next.js application that displays content from a WordPress blog via API calls. However, I've noticed that sometimes certain pages of my app return a 404 status code, even though the content DISPLAYS CORRECTLY. And to fix this, I have no choice but to redeploy my application.
My current hypothesis is that this error occurs after deployment. When a page's cache updates through revalidation, it tries to retrieve page information via the WordPress API. But if the API doesn't function properly and returns an invalid format, I call the notFound() function, causing the page to become a 404. However, what I don't understand is that during the next successful cache revalidation, my Next.js app regenerates the page correctly but does not update the status code. Do you have any ideas? If so, I'd love to hear them! 😄
4 Replies
Siamese CrocodileOP
@Arinji I'm so sorry to ping you but I'm kind of desperate 😅
@Siamese Crocodile <@890486507872342027> I'm so sorry to ping you but I'm kind of desperate 😅
You shld bump your questions if you don't see answers, also as someone you did ping.. I have no clue what to say.. you need to show code cause all of what you wrote, just says nothing to me.
Siamese CrocodileOP
I understand, thank you anyway ! I created an issue about it on next js github with a minimal code reproduction, let's see if someone fine any solution 🤞