Cron doesn't work on Heroku only locally

Cron doesn't work on Heroku only locally
0

#1

This is a personal project which I made with Node, Express and Mongo.

I’ve been trying for a few days now to make my web app send an email at certain times (2am and every 4 hours onwards) throughout the day. The emails are retrieved through a mongo database. It works just fine locally but on Heroku it doesn’t work at all.

I don’t know if the heroku logs will help but I’ve posted the last 500 of them here

I have the Cron job in the index.js file and even tried requiring it in app.js.

Here’s the source of index.js

I’ve removed sensitive information such as API KEYS.

Don’t know if this matters but I am using a free Heroku account

Here’s the project itself


#2

I don’t use Heroku, but it seems like they have a service add-on that runs scheduled jobs. Beyond that, the Heroku documents talk about scheduling via their own process model, but the upshot is that I think you won’t be able to run cron on the Heroku platform.