By 1776
I have this NextJS static site with 3 pages (/, /sub/page1, /sub/page2).
It all works on local machine, and saw those 2 sub pages in build logs.
[2021-08-09 20:55:04] Page Size First Load JS
[2021-08-09 20:55:04] ┌ ○ / 103 kB 180 kB
[2021-08-09 20:55:04] ├ /_app 0 B 73.5 kB
[2021-08-09 20:55:04] ├ ○ /404 3.18 kB 76.7 kB
[2021-08-09 20:55:04] ├ ○ /sub/page1 2.58 kB 79.9 kB
[2021-08-09 20:55:04] └ ○ /sub/page2 2.48 kB 79.8 kB
[2021-08-09 20:55:04] + First Load JS shared by all 73.5 kB
[2021-08-09 20:55:04] ├ chunks/framework.c93ed7.js 42.6 kB
[2021-08-09 20:55:04] ├ chunks/main.655ad0.js 20.3 kB
[2021-08-09 20:55:04] ├ chunks/pages/_app.00ff22.js 8.88 kB
[2021-08-09 20:55:04] ├ chunks/webpack.415df0.js 1.72 kB
[2021-08-09 20:55:04] └ css/a53ece9f561abae757e6.css 2.28 kB
[2021-08-09 20:55:04]
[2021-08-09 20:55:04] λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
[2021-08-09 20:55:04] ○ (Static) automatically rendered as static HTML (uses no initial props)
[2021-08-09 20:55:04] ● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
[2021-08-09 20:55:04] (ISR) incremental static regeneration (uses revalidate in getStaticProps)
[2021-08-09 20:55:04]
[2021-08-09 20:55:05] info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
[2021-08-09 20:55:05] info - using build directory: /workspace/web/.next
[2021-08-09 20:55:05] info - Copying "static build" directory
[2021-08-09 20:55:05] info - No "exportPathMap" found in "next.config.js". Generating map from "./pages"
[2021-08-09 20:55:06] info - Launching 7 workers
[2021-08-09 20:55:06] info - Exporting (0/4)
[2021-08-09 20:55:06] info - Copying "public" directory
[2021-08-09 20:55:06] info - Exporting (1/4)
[2021-08-09 20:55:06] info - Exporting (2/4)
[2021-08-09 20:55:06] info - Exporting (3/4)
[2021-08-09 20:55:07] info - Exporting (4/4)
[2021-08-09 20:55:07] Export successful. Files written to /workspace/web/out
[2021-08-09 20:55:16]
[2021-08-09 20:55:16] => Using static site output directory out
[2021-08-09 20:55:16] => Using document root /workspace/web/out
[2021-08-09 20:55:16] => Uploading files to Spaces
[2021-08-09 20:55:16] 404.html
[2021-08-09 20:55:17] _next/static/D_atJx2K517nLQa-IEg6T/_buildManifest.js
[2021-08-09 20:55:17] _next/static/D_atJx2K517nLQa-IEg6T/_ssgManifest.js
[2021-08-09 20:55:17] _next/static/chunks/10.f75ce268f49e89acdd00.js
[2021-08-09 20:55:18] _next/static/chunks/198.f37c103fa39a0f350427.js
[2021-08-09 20:55:18] _next/static/chunks/214.9f4b917a2fb0e82c9f73.js
[2021-08-09 20:55:19] _next/static/chunks/2c796e83.c4bfdc924d2fb2c8c18d.js
[2021-08-09 20:55:19] _next/static/chunks/2df5cbd4-314b274ddcc3cf723dfc.js
[2021-08-09 20:55:19] _next/static/chunks/387.f587573ff3f7573625f6.js
[2021-08-09 20:55:20] _next/static/chunks/570.2c6c8781eb3261e287a9.js
[2021-08-09 20:55:20] _next/static/chunks/578.216282282ab2726ebd89.js
[2021-08-09 20:55:20] _next/static/chunks/611-1044feb5cfc5c3d337ae.js
[2021-08-09 20:55:20] _next/static/chunks/947-00450b08213316ffb0e8.js
[2021-08-09 20:55:20] _next/static/chunks/framework-c93ed74a065331c4bd75.js
[2021-08-09 20:55:21] _next/static/chunks/main-655ad0ce567efa01caa9.js
[2021-08-09 20:55:21] _next/static/chunks/pages/_app-00ff2223b1bdf8be4954.js
[2021-08-09 20:55:21] _next/static/chunks/pages/_error-9faf4177fb4e528b4124.js
[2021-08-09 20:55:21] _next/static/chunks/pages/index-deeab5780fba94d69397.js
[2021-08-09 20:55:21] _next/static/chunks/pages/sub/page1-28ca58748f288a98cb31.js
[2021-08-09 20:55:21] _next/static/chunks/pages/sub/page2-d20eef6f22fc54eded17.js
[2021-08-09 20:55:22] _next/static/chunks/polyfills-a54b4f32bdc1ef890ddd.js
[2021-08-09 20:55:22] _next/static/chunks/webpack-415df06d39239d2b5694.js
[2021-08-09 20:55:22] _next/static/css/a53ece9f561abae757e6.css
[2021-08-09 20:55:22] favicon.ico
[2021-08-09 20:55:22] index.html
[2021-08-09 20:55:23] sub/page1.html
[2021-08-09 20:55:23] sub/page2.html
[2021-08-09 20:55:23] vercel.svg
But when I go to the live app, sub pages shows 404. Please help me.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
👋 @1776
It looks like this is a single page app that has client side routing. If that’s the case, setting the catchall to index.html in the apps Settings > static site > Custom Pages > Catchall.
Also, I’m not super familiar with NextJS so I could be wrong here, but the logs posted look as though SSG is enabled for this site which means that some sort of server side rendering will be required (?). This mode would probably need to be set to “Static” to run as a static site on App Platform.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.