Next.js Discord

Discord Forum

next.js 13.4 not found custom page stopped work

Unanswered
Giant panda posted this in #help-forum
Open in Discord
Giant pandaOP
hey guys, i am using app router 13.4 and the not-found.tsx custom page worked for me suddenly its stopped to work and i always get the default 404 page someone knows how to fix that?
the not-found.tsx file is in my root app folder
not found page code :

import type { Metadata, NextPage } from 'next';
import Image from 'next/image';
import Link from 'next/link';

export const metadata: Metadata = {
title: '404',
};

const NotFound: NextPage = () => {
return (
<section className='error-404-main-container'>
<div>404</div>
</section>
);
};

export default NotFound;

that how i am importing:

import { notFound } from 'next/navigation';
const article: ArticleModel | null = await articleService.getArticle(articleId);

if (!article) {
return notFound();
}

8 Replies

Giant pandaOP
its is not-found.tsx
it worked and suddenly stopped working
Is it in your app folder?
Giant pandaOP
yes
it worked before with the custom page not its always giving me the default page, btw the 500 error.tsx and global-error.tsx are working for me only the not-found
this is the error i get when i route to not found page

Error: NEXT_NOT_FOUND
at notFound (webpack-internal:///(rsc)/./node_modules/next/dist/client/components/not-found.js:23:19)
at Object.getArticle (webpack-internal:///(rsc)/./app/services/articleService.ts:19:77)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Module.generateMetadata (webpack-internal:///(rsc)/./app/(pages)/[category]/[subcategory]/[articleId]/page.tsx:17:25) {
digest: 'NEXT_NOT_FOUND'
Giant pandaOP
i solved the problem i have route group that called (pages) and it stores all my pages somehow the not-found.tsx works only in my route group