Dynamic route 404 error (_next/static) - only in production #12578
-
Dynamic routes works well but strange error appears in console. It occurs only in production.
After click there is correct path in browser: but in console window there is a strange 404 error: To ReproduceSteps to reproduce the behavior, please provide code snippets or a repository:
Expected behaviorNo console errors. ScreenshotsSystem information
Thanks ❤️ |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
You should only use the The 404 is because Next is trying to prefetch the route that is linked in your |
Beta Was this translation helpful? Give feedback.
-
@jamesmosier what makes page, well, a page in this case? |
Beta Was this translation helpful? Give feedback.
-
Sorry, I missed that there was a different branch to be looked at. In that case, you'll want your <Link href="/tasks/[taskid]" as={`/tasks/${task._id}`}> |
Beta Was this translation helpful? Give feedback.
-
Looks like it does: <Link href="/tasks/[taskid]" as={`/tasks/${task._id}`}> |
Beta Was this translation helpful? Give feedback.
-
I commented out the navigation components I found in As a secondary test I replaced |
Beta Was this translation helpful? Give feedback.
I commented out the navigation components I found in
components/header/Header.tsx
and the error went away. I think this is because the links in the navigation are not correct and havehref="#"
causing issues withnext/link
.As a secondary test I replaced
href="#"
withhref="/"
and that also made that 404 go away.