NextJS site published successfully, but just 404

Base directory
    Not set
Build command
    next build
Publish directory
    .next
Build status
    Active

Git repo of the source: https://github.com/nk9/bryson-9

When I download the site as a package, it all looks OK I think.

Here is the build on Netlify:

12:04:34 AM: Route (pages)                              Size     First Load JS
12:04:34 AM: β”Œ β—‹ / (1926 ms)                            1.07 kB         106 kB
12:04:34 AM: β”œ   /_app                                  0 B            85.4 kB
12:04:34 AM: β”œ β—‹ /404                                   181 B          85.6 kB
12:04:34 AM: β”œ Ξ» /api/check_numbers                     0 B            85.4 kB
12:04:34 AM: β”œ β—‹ /check1 (2019 ms)                      1.86 kB         132 kB
12:04:34 AM: β”œ β—‹ /check2-89o6Q (2044 ms)                1.87 kB         132 kB
12:04:34 AM: β”œ β—‹ /check3-46GfRA (1967 ms)               1.9 kB          132 kB
12:04:34 AM: β”œ β—‹ /page2 (1985 ms)                       3.23 kB         108 kB
12:04:34 AM: β”œ β—‹ /page3 (2079 ms)                       3.2 kB          108 kB
12:04:34 AM: β”” β—‹ /success-nKsp7L (1907 ms)              921 B           101 kB
12:04:34 AM: + First Load JS shared by all              85.6 kB
12:04:34 AM:   β”œ chunks/framework-3b5a00d5d7e8d93b.js   45.4 kB
12:04:34 AM:   β”œ chunks/main-f2e125da23ccdc4a.js        26.7 kB
12:04:34 AM:   β”œ chunks/pages/_app-65b8d67529ac7894.js  12.4 kB
12:04:34 AM:   β”œ chunks/webpack-0b5d8249fb15f5f3.js     939 B
12:04:34 AM:   β”” css/27d177a30947857b.css               194 B
12:04:34 AM: Ξ»  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
12:04:34 AM: β—‹  (Static)  automatically rendered as static HTML (uses no initial props)
12:04:34 AM: ​
12:04:34 AM: (build.command completed in 21.7s)

What am I missing?

Hey @nk9,

Did you make sure the Next.js Runtime is installed: GitHub - netlify/next-runtime: The Next.js Runtime allows Next.js to run on Netlify with zero configuration?

It installs automatically in most cases, but if it did not, you might have to manually install it.

Thanks for the reply. It looks like the integration is already installed. Any other ideas?

Oooooookay, so I just had another look and it’s now working. I didn’t change anything for the last 7 hours, no deploy. But: the site is now working as expected.

Is there any way I can determine what happened to fix it?

Hi, @nk9. You can download the deploys and that will reveal the root cause.

I’ve examined the traffic for the site since it was created. There have been 404s for only three deploys of the site, the three below:

https://app.netlify.com/sites/stirring-churros-252537/deploys/63a39ce34684a50d0ae62482
https://app.netlify.com/sites/stirring-churros-252537/deploys/63a39d782460ac13497f3327
https://app.netlify.com/sites/stirring-churros-252537/deploys/63a39ee39d2bde0008e18312

If you download those three deploys and check the base directory of the zip file, please note that there is no index.html file. This is a requirement for the base path of / to return a 200 status.

I see that both the publish directory and the build command were changed around the time of the deploy that does contain the index.html file in the base of the publish directory. My best guess is those two changes were what fixed this.

Please reply anytime if there are other questions about this.

1 Like

OK, that makes sense. Thanks for your help!