Home
Support Forums

Deployed nextjs site gives 404

  • My nextjs monorepo was previously building just fine.
  • I was previously statically generating the site (via next export) and it was building fine with no issues
  • I added i18n routing to nextjs. This feature requires a nextjs server (via next start) and this is when the problem started

Environment

Troubleshooting

  • as per Failed during stage 'building site': Deploy directory 'out' does not exist , I added target: "serverless" to next.config.js
  • build command = yarn next build
  • This resulted in “deploy directory out not found”
  • So then I changed the deploy directory to .next and it built fine.
  • But now when I open the app in the browser, I get a 404…
  • Furthermore, it’s not even the nextjs 404 page—it’s the netlify 404 page
  • so it seems like the server isn’t even running

Update:

  • i figured out the issue
  • had to manually install the nextjs plugin in the netlify UI
  • I guess what happened is that the plugin doesn’t get automatically installed on legacy sites (this app has been around since before this plugin). So it needed to be manually enabled /shrug