Got 404 not found after deploying a NextJS app

I have deployed my NextJS app using github from a specific folder but I am having a 404 error not found

My site name is

My github repo

Build log

  • 9:37:50 PM: Netlify Build
    9:37:50 PM: ────────────────────────────────────────────────────────────────
    9:37:50 PM: ​
    9:37:50 PM: ❯ Version
    9:37:50 PM: @netlify/build 30.0.5
    9:37:50 PM: ​
    9:37:50 PM: ❯ Flags
    9:37:50 PM: accountId: 61ecb94c0c553c0439814299
    9:37:50 PM: baseRelDir: true
    9:37:50 PM: buildId: 67e4576922438f09854b2083
    9:37:50 PM: deployId: 67e4576922438f09854b2085
    9:37:51 PM: ​
    9:37:51 PM: ❯ Current directory
    9:37:51 PM: /opt/build/repo/frontend
    9:37:51 PM: ​
    9:37:51 PM: ❯ Config file
    9:37:51 PM: No config file was defined: using default values.
    9:37:51 PM: ​
    9:37:51 PM: ❯ Context
    9:37:51 PM: production
    9:37:51 PM: ​
    9:37:51 PM: Build command from Netlify app
    9:37:51 PM: ────────────────────────────────────────────────────────────────
    9:37:51 PM: ​
    9:37:51 PM: $ npm run build
    9:37:51 PM: > frontend@0.1.0 build
    9:37:51 PM: > next build
    9:37:52 PM: :warning: No build cache found. Please configure build caching for faster rebuilds. Read more: No Cache Detected | Next.js
    9:37:52 PM: ▲ Next.js 15.2.2
    9:37:52 PM: Creating an optimized production build …
    9:38:03 PM: ✓ Compiled successfully
    9:38:03 PM: Linting and checking validity of types …
    9:38:05 PM: Collecting page data …
    9:38:07 PM: Generating static pages (0/11) …
    9:38:07 PM: null
    9:38:07 PM: Generating static pages (2/11)
    9:38:07 PM: Generating static pages (5/11)
    9:38:07 PM: Generating static pages (8/11)
    9:38:07 PM: ✓ Generating static pages (11/11)
    9:38:08 PM: Finalizing page optimization …
    9:38:08 PM: Collecting build traces …
    9:38:12 PM: Route (app) Size First Load JS
    9:38:12 PM: ┌ ○ / 2.57 kB 111 kB
    9:38:12 PM: ├ ○ /_not-found 977 B 102 kB
    9:38:12 PM: ├ ƒ /[id] 5.1 kB 117 kB
    9:38:12 PM: ├ ○ /list 2.76 kB 113 kB
    9:38:12 PM: ├ ○ /login 1.48 kB 131 kB
    9:38:12 PM: ├ ○ /newPost 1.52 kB 123 kB
    9:38:12 PM: ├ ○ /profile 4.65 kB 136 kB
    9:38:12 PM: ├ ○ /profile/edit 1.6 kB 128 kB
    9:38:12 PM: └ ○ /register 1.23 kB 131 kB
    9:38:12 PM: + First Load JS shared by all 101 kB
    9:38:12 PM: ├ chunks/4bd1b696-546d85b3d30c84c6.js 53.2 kB
    9:38:12 PM: ├ chunks/684-e230e248f2d433f6.js 45.3 kB
    9:38:12 PM: └ other shared chunks (total) 2.52 kB
    9:38:12 PM: ƒ Middleware 32.3 kB
    9:38:12 PM: ○ (Static) prerendered as static content
    9:38:12 PM: ƒ (Dynamic) server-rendered on demand
    9:38:12 PM: ​
    9:38:12 PM: (build.command completed in 21s)
    9:38:12 PM: ​
    9:38:13 PM: (Netlify Build completed in 22.1s)
    9:40:04 PM: Section completed: building
    9:43:00 PM: Finished processing build request in 5m31.623s

@rawda Check the Publish directory in your Build Configuration.
https://docs.netlify.com/configure-builds/overview/

It looks like it’s configured to deploy the frontend directory:
https://myestate1.netlify.app/readme.md
https://myestate1.netlify.app/next.config.mjs
https://myestate1.netlify.app/src/middleware.js

When confused you can always see what you deployed with the Deploy File Browser:
https://answers.netlify.com/t/new-feature-browse-files-in-your-deploy-with-the-deploy-file-browser/105196

The general ‘File Not Found’ Support Guide is here:
https://answers.netlify.com/t/support-guide-i-ve-deployed-my-site-but-i-still-see-page-not-found/125

Hi @nathanmartin
I updated the configuration but still getting 404

@rawda If you run your build locally, you’ll find that your /dist folder is empty (even after build):

Your project is building into .next

I don’t work with Next so can’t give clear instructions/feedback.
My understanding was that Netlify’s “adapter” is supposed to take care of some of this for you.
You can see their documentation here:

Now it works.
Thank you!