Question

Getting 404 for resources for the deployed Nextjs application

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?


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.