Report this

What is the reason for this report?

Getting 404 for resources for the deployed Nextjs application

Posted on August 28, 2022

I’m using Nx workspace with the following directory structure:

apps
   courses
      nextjs
        next-config.js
dist
   apps
      courses
         nextjs
           .next

where dist contains built nextjs application as a result of running (build command):

npx nx build courses-nextjs

I tried to run it all locally from the root (deploy command), all works good:

npx next start dist/apps/courses/nextjs

I created WebService app on the platform. Configured build and deploy commands as specified above. The application is created and deployed. I can access the main index.html file, however for all other resources I get 404. What’s the reason for this?



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!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Found the problem, for some reason I had HTTP Request Routes setting set for something other than / in my Web Service component. Changed it to root and all worked OK.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.