0

I have an azure function timer with the following cron expression: '0,30 * 0-8,21-23 * * *'. I.e. every 30 seconds from 0-8 and 21-23 UTC (or at least I expect it to be UTC).

But now when I run my function locally using func start, I get the following:

[2021-11-24T06:45:15.531Z] The next 5 occurrences of the 'function_name' schedule (Cron: '0,30 * 0-8,21-23 * * *') will be:
[2021-11-24T06:45:15.533Z] 11/24/2021 21:00:30+11:00 (11/24/2021 10:00:30Z)
[2021-11-24T06:45:15.535Z] 11/24/2021 21:01:00+11:00 (11/24/2021 10:01:00Z)
...

Notice that the next X occurrences are using the local time zone (+11:00). With the next trigger being at exactly 21:00:30+11:00.

This is wrong (I think) and if you see the log timestamps (in UTC) you can see that we are NOW in the 0-8 window and should not need to wait for the 21-23 window.

Note: I am definitely not overriding the WEBSITE_TIME_ZONE setting.

The command I use to run the function locally is: func start

[Edit] for clarity please see issue I have opened on the Azure-Functions github page.

gatapia
  • 3,574
  • 4
  • 40
  • 48
  • try running with the `func host start` command –  Nov 24 '21 at 07:42
  • @HariKrishnaRajoli-MT no difference, infact `func start` is just the v2 version of `func host start` – gatapia Nov 24 '21 at 07:50
  • Anyway, to make the cron expression looks clear, it's better to override the `WEBSITE_TIME_ZONE` setting. And the messages you got may due to the runtime is in your local machine. Did you test the time trigger in azure? – Tiny Wang Nov 24 '21 at 08:40
  • The default time zone used with the CRON expressions is Coordinated Universal Time (UTC). To have your CRON expression based on another time zone, you have to create /override an app setting for your function app named `WEBSITE_TIME_ZONE`. Still If not coming, the point to note here is `WEBSITE_TIME_ZONE` is not currently supported on the Linux Consumption plan. –  Nov 24 '21 at 09:02
  • Any update to the issue? –  Dec 02 '21 at 02:44
  • @HariKrishnaRajoli-MT not really. I confirmed in the [bug report](https://github.com/Azure/Azure-Functions/issues/2109) that the ncron scheduler is ignoring the WEBSITE_TIME_ZONE but I have not had any resolution or suggestion from MS. – gatapia Dec 03 '21 at 03:17

0 Answers0