Many of the solutions in this guide involve using the Heroku Command line interface (CLI). If you don't have it, download it here.
Basics
- [ ] Do you have a
Procfile set to web: node server.js?
- [ ] Is your PORT set to
process.env.PORT?
- [ ] Check that your config & env variables are set correctly:
heroku config -a <app name>
- [ ] Did you update your app's domain name or callback URL to your authentication / OAuth provider's console (e.g. google cloud console, Azure)?
- [ ] Did you add
/node_modules to your .gitignore file?
- [ ] Did you change any file names in your VS Code? Make sure to only change file names with
git mv <old file name> <new file name> as git will track these changes.
- [ ] Specifically check your
require() statements for inconsistencies in case (e.g. uppercase file names)
Check your logs
- [ ] Get detailed logs by running
heroku logs -a <app name> or heroku logs --tail -a <app name>
- [ ] Run a local instance of your Heroku app with
heroku local web and look for errors
Finishing up
- [ ] After making changes, clear the Heroku build cache by first installing the Heroku builds plug-in:
heroku plugins:install heroku-builds and then
clear the cache: heroku builds:cache:purge -a <app name>. Lastly, commit the changes. If you have no other changes to commit, run: git commit --allow-empty -m 'Purge cache'
Still having issues?
- [ ] If your logs indicate that your Heroku app is having difficulties connecting to MongoDB, you may:
- Whitelist your IP address on the MongoDB Network Access page in your cluster or database. Click "Add IP Address" and change it to
allow access from anywhere or 0.0.0.0. (Only recommended for apps in development, not production)
- You can use an add-on that provides a static outbound IP address, and whitelist this IP.
- The alternative is to purchase in Heroku Private Spaces, which will also provide a static outbound IP
- This article has some information if you would like to look into it further.
- [ ] Consider filing a ticket with Heroku for personalized help, as per their website.
You did it! 🙂🏅🙌🏽
- [ ] Pat yourself on the back, champ. You bested the challenges that stood in your way, and have an awesome app to showcase. Now I don't know about you, but I could use a good stretch. 🏃🏽
Connect with me: