notFound() not calling not-found route
Answered
French Angora posted this in #help-forum
French AngoraOP
In my dynamic route as y guys can see in the pic i wanted when a product is not found to call the not-found route which we do using the notFound method but somehow when i go to a dynamic route that was not generated using generateStaticParams they redirect me to the error page not the not-found page (NOTE : ido have a not-found route as well as an error route)
Answered by riský
are you on latest nextjs version (just checking it hasn't been fixed by now)
18 Replies
can you console.log the
product and make sure it actually doesn't existand possibly
console.log(!!product) to see if its truthyFrench AngoraOP
Yes i did it but notFound() not trigger it, idk why ?
and im asuming youhave tried console.log instead of notFound to test
French AngoraOP
no, i did both brother console.log show in dev tools but notFound not work
try removing
if(!product)French AngoraOP
@aardani try removing `if(!product)`
French AngoraOP
you mean to call notFound directly ?
yes
French AngoraOP
let me try
@French Angora no, i did both brother console.log show in dev tools but notFound not work
yeah i gathered, i just wanted to be 100% sure it wasn't that as an issue
@aardani yes
French AngoraOP
didnt work !
are you on latest nextjs version (just checking it hasn't been fixed by now)
Answer
French AngoraOP
i update from 13.5.1 to 13.5.3 and is work now !
so, the update fixed your issue?
French AngoraOP
yes but why ?
there has been so many fixes, so i can't say what did it
French AngoraOP
I see, thanks you brother for help