Next.js Discord

Discord Forum

NotFound using `/app` router

Unanswered
Pteromalid wasp posted this in #help-forum
Open in Discord
Pteromalid waspOP
I have a running application with Next 13 using the /app router.
I have a /not-found.tsx file inside my /app/[locale]/ that I want to use to customize my error page.

When I'm in [slug] and waiting for dynamic data, here is my functionnal code:
import { notFound } from "next/navigation";
...
  if (!work) {
    notFound();
  }

This code works, and return the not-found.tsx.
So, I have a /work page that contains all my works, and I have a /work/[slug] page for each works.

BUT, if I go to /workfdfdf manually, it render the default 404 This page could not be found. Next page.
I would expect my not-found.tsx file to be render? Following the official doc: https://nextjs.org/docs/app/api-reference/file-conventions/not-found.

Thanks!

14 Replies

@DirtyCajunRice | AppDir that would fall under the **root** not found
Pteromalid waspOP
How Can i render my custom noy-found.tsx component to all bad routes?
Pteromalid waspOP
Thanks, I'll try this asap
@DirtyCajunRice | AppDir /app/not-found.tsx
Pteromalid waspOP
It's seems that using the "next-intl": "^2.15.0-beta.5" to handle the [locale], it doesn't works 😦
@Pteromalid wasp It's seems that using the "next-intl": "^2.15.0-beta.5" to handle the [locale], it doesn't works 😦
I mean… thats the root not found… it doesnt go any higher than that
@DirtyCajunRice | AppDir I mean… thats the root not found… it doesnt go any higher than that
Pteromalid waspOP
To manage the /app/[locale]/... I need to create my layout that include the html and body tag inside the app/[locale] folder.
@DirtyCajunRice | AppDir I mean… thats the root not found… it doesnt go any higher than that
Pteromalid waspOP
I can't create file inside /app. It's need to be inside the /app/[locale]
@Pteromalid wasp To manage the `/app/[locale]/...` I need to create my layout that include the `html` and `body` tag inside the `app/[locale]` folder.
i dont know anything about the next-intl package. so if its an issue specifically because of that package modifying shit you will need to wait for someone else :/
@DirtyCajunRice | AppDir i dont know anything about the next-intl package. so if its an issue specifically because of that package modifying shit you will need to wait for someone else :/
Pteromalid waspOP
Yeah, no problem! It's so frustrating that Next /app router don't support the i18n. I had to find a solution ahah
@Pteromalid wasp Yeah, no problem! It's so frustrating that Next `/app` router don't support the i18n. I had to find a solution ahah
ive seen tooooons of people with issues surrounding intl. so i assume they are aware… hopefully
Pteromalid waspOP
Hopefully 🙂
@DirtyCajunRice | AppDir /app/not-found.tsx
Eurasian Hobby
I have layouts in [locale] but not root though, if i wanna use the not-found in root, it requires a rootlayout :/