Unable to run cron on defined time

This should run at 4.30 AM UTC, but not working. Though rate is working and also cron with all * option is working…

  pickDailyTest:
    handler: src/api/agenda/index.pickDailyTest
    events:
      - schedule:
          enabled: true
          name: jobPickDailyTest
          description: 'Daily job called to pick test'
          rate: cron(30 4 * * ? *)

Schedule definition seems to be okay.
I assume there is something wrong with your handler.

  • Check your serverless.yml file with sls print
  • Deploy your serverless.yml file with sls deploy -v
  • Test your handler manually with sls invoke -f pickDailyTest -l
  • Check Cloudwatch Logs after 4:30AM for entries

Thanks!

Can you please let me know how to test locally with UTC time.

@Franky Hi, Thanks! but cron is running when I used * for all six options but unable to run with defined UTC time…

1 Like
send:
handler: am.send
events:
  - schedule:
      rate: cron(40 10 ? * 3 *)
  - http:
      path: send
      method: get
      cors: true

I am having exactly the same issue. Cron does not work on a defined time. I tested with rate(3 minutes) it worked perfectly. It also works when I trigger my function making a GET request.

I checked Cloudwatch logs. My function is never called when using CRON.
Would you know what I else I could do? Thanks.