node-cron / node-cron

A simple cron-like job scheduler for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node cron after Deploy not work But works on my machine

oren1122 opened this issue · comments

I use render to Deploy my server node cron does not work But works on my machine.

const job = new CronJob({
  //* * * * * every minute --- for Debugging
  //0 */6 * * * every 6 hours --- in production
  cronTime: "0 */6 * * *",
  onTick: function () {
    console.log("start crawling", new Date());
  },
  start: true,
});

async function startServer() {
  await mongoose.connect(process.env.MONGO);
  server.listen(PORT, () => {
    console.log(`Listening on ${PORT}...`);
  });
  job.start();
}

startServer();

I didn't see the logs in render What should I do

I think i have the same issue, and i am suspecting render
Have you fixed it?

I am also facing same issue since 6 months I have to deploy code on AWS again and it works for a month or some days
So could you help how do I debug and check why it is stopped

@Sathish-Kumar-A yep!

Actually it didn't worked, I deployed on digital ocean server it worked on local machine but not after deployment

Oh, then it has nothing to do with the cron implementation