#Custom404 is not working

1 messages · Page 1 of 1 (latest)

untold bronzeBOT
#

Hi @ebon dock. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the information provided in the extracts, it seems like you have correctly created a custom 404 page by creating a pages/404.js file. This file should be statically generated at build time and used to display a custom 404 page when a page is not found.

However, there are some issues reported by users on GitHub where the custom 404 page is not working as expected. Some users have found success by creating a not-found.tsx or not-found.jsx file in the app directory instead.

Here is an example of how you can define a custom 404 page:

export default function Custom404() {
 return <h1>404 - Page Not Found</h1>
}

If you're still facing issues, it might be helpful to check the version of Next.js you're using. Some users have reported issues with custom 404 pages in Next.js 13, and there are ongoing discussions about this on GitHub.

Sources:


Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@ebon dock kapa.ai is still learning and improving, please let us know how it did by reacting below

ebon dock
untold bronzeBOT
#

Let me check the knowledge base for you. One moment! :books:

#

This could be due to differences between your local development environment and the production environment on Vercel. Here are a few things you could check:

  1. Next.js version: Ensure that the version of Next.js you're using locally is the same as the one used in your Vercel deployment. You can check this in your package.json file.

  2. Dependencies: Make sure all dependencies are installed and up-to-date. You can do this by running npm install or yarn install in your project directory.

  3. Build process: Try running the build process locally using next build and then serve it using next start. This will help you identify if the issue is related to the build process.

  4. Configuration files: Check your next.config.js and vercel.json files for any discrepancies that might affect how pages are served.

  5. Clear cache: Sometimes, the development server might be serving cached pages. You can clear the cache and restart your development server.

If none of these suggestions work, it might be helpful to create a minimal reproduction of your issue and share it on the Next.js GitHub for further assistance.

Sources:


Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: