Deployed Next.js site shows 404 despite successful build

Subject: Website showing 404 Not Found after successful deployment

Current versus Expected behavior

  • Current behavior: My website deployed on Vercel at embico-test.vercel.app is showing a “404: This page could not be found” error page.
  • Expected behavior: The website should display the content of the root page (/) as it does in my local development environment.

Code, configuration, and steps that reproduce this issue

  1. Project Setup: This is a Next.js project using React and TypeScript.
  2. Local Environment: The project works correctly when running locally (npm run dev) and is accessible at http://localhost:3000.
  3. GitHub Repository: The project source code is hosted on GitHub at https://github.com/ii-johan/my-embico-app. I have recently cleaned up the repository to remove build output folders (_next, .next, out, etc.) and node_modules, ensuring only source files are present.
  4. next.config.ts: The project is configured for static site export with the following setting:
const nextConfig: NextConfig = {
  // ... other configs
  output: 'export', // Configured for static export
  // ... other configs
};
  1. Vercel Deployment: The project is connected to the GitHub repository, and Vercel automatically triggers deployments on new commits. The latest deployment shows “Deployed (completed)” status.
  2. Vercel Logs:
  • Build logs show the build process completed successfully with no errors.
  • The logs indicate that the root path (/) was prerendered as static content (○ / prerendered as static content).
  • Runtime logs show no errors.
  1. Steps Taken:
  • Confirmed Vercel is connected to the correct GitHub repository (ii-johan/my-embico-app).
  • Verified Vercel’s Root Directory setting is correct (empty, matching GitHub root).
  • Manually cleaned the GitHub repository via the website to remove build outputs and node_modules.
  • Triggered re-deployments on Vercel after cleaning the GitHub repo.
  • Cleared smartphone browser cache before accessing the Vercel URL.

Despite a successful build and no runtime errors, and confirming the static export configuration and clean GitHub repo, the deployed site still shows a 404 error. It seems Vercel might not be correctly serving the generated index.html file for the root path.

Project information (URL, framework, environment, project settings)

  • Vercel Project URL: https://embico-test.vercel.app (The specific deployment URL is my-embico-lmgawllpr-ii-s-projects.vercel.app, but the primary domain is embico-test.vercel.app)
  • GitHub Repository URL: https://github.com/ii-johan/my-embico-app
  • Framework: Next.js (Version 15.3.2), React (Version 19.0.0)
  • Environment: Production
  • Vercel Project Settings: Standard Next.js settings, Root Directory empty, Build Command npm run build, Output Directory automatically detected (should be out due to output: 'export').

There’s another community post with 404 debugging tips that might be helpful. Please give these solutions a try and let us know how it goes.

A human should be around soon to offer more advice. But you can also get helpful information quickly by asking v0.

Hi Johan,

I cloned your code into a brand new project and selected the Framework as “Next.js”, and your website ran successfully.
Could you please navigate to your Project Settings > Build and Deployment > Framework Settings (click here) and select “Next.js”? Redeploying after that should make your deployment work as expected.

Attaching screenshots for your reference.


1 Like