Page Not Found, and no build

Hello, I have a problem with deploying my NextJS site.

I run a deploy, and I works totally fine and the site is live. Then I go to the site and get a “Page Not Found”-message.
When I download the build files it seems like it is just hosting all the files (within same folders) from Github. I have tried to go to the domain/pages/index.js and it works and I get the code.

The domain is

The build output:

8:06:33 PM: Executing user command: npm run build
8:06:34 PM: > br-reg-system@1.0.0 build /opt/build/repo
8:06:34 PM: > next build
8:06:34 PM: Browserslist: caniuse-lite is outdated. Please run next command npm update
8:06:34 PM: Warning: No build cache found. Please configure build caching for faster rebuilds. Read more:
8:06:34 PM: Creating an optimized production build…
8:06:58 PM: Compiled successfully.
8:06:58 PM: Automatically optimizing pages…
8:07:00 PM: Page Size First Load JS
8:07:00 PM: ┌ ○ / 2.58 kB 233 kB
8:07:00 PM: ├ └ css/77c671b1533bce25839c.css 660 B
8:07:00 PM: ├ /_app 291 B 57.6 kB
8:07:00 PM: ├ ○ /404 2.58 kB 60.2 kB
8:07:00 PM: ├ ○ /registrer 8.07 kB 239 kB
8:07:00 PM: ├ └ css/d5b7fdd275e54fcbdfb4.css 692 B
8:07:00 PM: └ λ /sok 1.52 kB 232 kB
8:07:00 PM: └ css/ea6b46d0be8e614bce2f.css 676 B
8:07:00 PM: + First Load JS shared by all 57.6 kB
8:07:00 PM: ├ static/pages/_app.js 291 B
8:07:00 PM: ├ chunks/commons.db9b5a.js 10.5 kB
8:07:00 PM: ├ chunks/framework.8d738c.js 40.3 kB
8:07:00 PM: ├ runtime/main.e9b490.js 5.85 kB
8:07:00 PM: ├ runtime/webpack.b65cab.js 746 B
8:07:00 PM: └ css/498d61218e435377339b.css 239 B
8:07:00 PM: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
8:07:00 PM: ○ (Static) automatically rendered as static HTML (uses no initial props)
8:07:00 PM: ● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
8:07:00 PM: Skipping functions preparation step: no functions directory set
8:07:00 PM: Caching artifacts
8:07:00 PM: Started saving node modules
8:07:00 PM: Finished saving node modules
8:07:00 PM: Started saving build plugins
8:07:00 PM: Finished saving build plugins
8:07:00 PM: Started saving pip cache
8:07:07 PM: Finished saving pip cache
8:07:07 PM: Started saving emacs cask dependencies
8:07:07 PM: Finished saving emacs cask dependencies
8:07:07 PM: Started saving maven dependencies
8:07:07 PM: Finished saving maven dependencies
8:07:07 PM: Started saving boot dependencies
8:07:07 PM: Finished saving boot dependencies
8:07:07 PM: Started saving go dependencies
8:07:07 PM: Finished saving go dependencies
8:07:10 PM: Creating deploy upload records
8:07:10 PM: Build script success
8:07:10 PM: Starting to deploy site from ‘.’
8:07:10 PM: Creating deploy tree
8:07:11 PM: Starting post processing
8:07:11 PM: 0 new files to upload
8:07:11 PM: 0 new functions to upload
8:07:11 PM: Post processing done
8:07:11 PM: Site is live
8:07:58 PM: Finished processing build request in 1m49.579972784s

Hi there,

Did you see this guide yet? This is the best place to start for “Page Not Found” issues.

If you are still seeing issues after following the troubleshooting steps in this guide, please let us know!

Hi, thanks for answer!

I have readed a lot at that page, but didnt find any answer.
But, I have a theory. I think I cant server the page with Netlify because I use getServerSideProps

Hey @DanielMartinsen,

Maybe Cassidy’s recent blog post can give you a couple of pointers?

Out of interest – what happens if you change the build command to npm run build && npm run export?

I’m having the very same issue.
My web app was building alright and being exported correctly until I added fallback: true to some of my blog pages and this config generates an SSG instead of a purely static web site. SSGs can not be exported, so there isn’t an “out/” folder with an index file that can be served.

Are there any workarounds to this?

Are there any workarounds to this?

Hi, @darksoulsong, I know SSG as meaning “Static Site Generator”:

Is it possible you mean that the build generates code which does server-side rendering (SSR) and not SSG? (If not, what does SSG stand for?)

If you are trying to due SSR at Netlify first please read this:

That guide explains why SSR doesn’t work “out of the box” at Netlify. The following blog post, however, gives examples how it can be done using Functions:

If there are other questions, please let us know.

Hello Luke, sorry for keeping you waiting, I just had the time to answer now.

I’m referring to NextJS’s fallback feature on the newer versions. There are two new functions, getStaticProps and getStaticPaths with the mandatory fallback prop, which basically displays a 404 page on nonexistent content on false or tries to generate the pages dynamically on true.I’m not certain if NextJS uses SSR in the backgrounds to make this work.

I’ve been told that Netlify cannot handle dynamic sites, only static ones, so this is something I’d like to confirm with you guys.

Hi, @darksoulsong, based on that I’m almost certain that the dynamic fallback: true setting is SSR. So, fallback will need to be “false” for Netlify.

That or some variation of the solution above will be required (where serverless functions are used for the SSR).

1 Like