Next.js Discord

Discord Forum

page 404 Not found()

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
Hello all,

I am having some issues while building a page in nextjs. Basically I have an orders page where I list all orders each in Link component and when I try to navigate to it I get a 404 not found error: GET http://localhost:3000/_next/static/chunks/app/(pages)/orders/%255Bid%255D/page.js net::ERR_ABORT. But if I refresh the page, it all works well.

I tried lots of things, like:
- Adjusting the Link href and including an 'as' atribute as well
- Added export export const dynamic = 'force-dynamic' (I had another page that threw the same erorr and this solved it
- I added console.logs to the page to see if the fetching is done, and indeed it did, even the list of products from the orders gets printed before the page crashes, which led me to try removing some of the elements from the return
- Removed bits of elements from the return statement to see if it would render, and for some bits it did (like order details) but some not, like product list
- Other things that I don't really remember

Something is missing and I can't get my head around it. I am leaving some screenshots of my code and package.json for reference. PS, I built the app using the PayloadCMS ecommerce template.

11 Replies

Transvaal lionOP
Ah I forgot to mention that I also restarted the app, removed .next folder, etc. This error happens in both locally and production enviroment
Thanks for looking into this and please let me know if you need further info
Selkirk Rex
@Transvaal lion i suggest you use https://sourceb.in/ to send long blocks of code. These images aren't really that readable
Transvaal lionOP
Thanks for the tip!
Order page (orders/[id]) :https://sourceb.in/4CL0rJ6GgR
hope this helps
Transvaal lionOP
An extra note, if I add target="_blank" to the Link from the orders page, it opens the order in a new tab and loads it without an error