To preface, my web app has been pushed to Heroku.
I'm trying to successfully build my MERN web application onto Heroku, but when I visit my app page (https://safe-fortress-83003.herokuapp.com/), it just returns the error "Not Found" from the root GET response. When I view the logs for my Heroku app, this error displays when a root request is sent:
Error: ENOENT: no such file or directory, stat '/app/client/build/index.html'
So, I went into my local CLI and ran
heroku run bash, viewed the current files and directories, and found that /app/client/build/ didn't exist. This leads me to believe that it isn't being generated using my heroku-postbuild script defined in my package.json (no idea why it isn't running when I
git push heroku master). Out of desperation, I ran
npm install && npm run build inside my client folder (where my react app is located), and now the build folder containing index.html is on my heroku app. When I try to view the app however, I still get an error of "Not Found".
I've been trying to debug this for hours, no idea what is wrong. The static files (build folder) are being defined inside server.js if you'd like to take a look.
EDIT: I just removed build from .gitignore and pushed to heroku, and my app works now. So the main problem is that my heroku-postbuild script isn't running even though the name is clearly defined in this documentation: https://devcenter.heroku.com/articles/nodejs-support