Azure / azure-functions-host

The host/runtime that powers Azure Functions
https://functions.azure.com
MIT License
1.92k stars 442 forks source link

Timer trigger being interpreted in local time zone through local emulator #5865

Open fabio-muramatsu opened 4 years ago

fabio-muramatsu commented 4 years ago

Check for a solution in the Azure portal

Repro steps

I just found out that the Functions emulator interprets a cron expression in a timer trigger in the local time zone. I have a function with the following expression: 0 0 1,6,15,20 * * *. When I run it locally, the emulator shows this:

[4/6/2020 11:09:08 PM] The next 5 occurrences of the 'MetricPlatformAlertFunction' schedule (Cron: '0 0 1,6,15,20 * * *') will be:
[4/6/2020 11:09:08 PM] 04/06/2020 20:00:00-07:00 (04/07/2020 03:00:00Z)
[4/6/2020 11:09:08 PM] 04/07/2020 01:00:00-07:00 (04/07/2020 08:00:00Z)
[4/6/2020 11:09:08 PM] 04/07/2020 06:00:00-07:00 (04/07/2020 13:00:00Z)
[4/6/2020 11:09:08 PM] 04/07/2020 15:00:00-07:00 (04/07/2020 22:00:00Z)
[4/6/2020 11:09:08 PM] 04/07/2020 20:00:00-07:00 (04/08/2020 03:00:00Z)

According to the documentation, cron expressions are interpreted in UTC by default, and I don't have WEBSITE_TIME_ZONE set anywhere in my solution. I don't know if this is the expected behavior for the emulator, but the fact that it doesn't reflect the production behavior is confusing in my opinion.

Expected behavior

The trigger should be invoked at 1h, 6h, 15h and 20h UTC, not local (UTC-7).

Actual behavior

The trigger gets invoked at 1h, 6h, 15h and 20h UTC-7.

Additional information

When deployed to Azure and in an app service plan, the expression gets interpreted in UTC time.

kashimiz commented 4 years ago

Thank you for reporting this issue, @fabio-muramatsu. Can you provide more information about your local development system such as whether you're on Windows/Linux/Mac, what language the trigger is defined in, and whether you're using an Azure Storage account, or an emulator like Azure Storage Emulator or Azurite?

fabio-muramatsu commented 4 years ago

Sure.

Let me know if I can provide more information.

kashimiz commented 4 years ago

Thank you. I've been able to reproduce this bug under the described conditions.

kashimiz commented 4 years ago

@mathewc or @fabiocav any idea what might be going on here?

klenium commented 4 years ago

Can confirm too, however I'm using a real storage account.

v-bbalaiagar commented 2 years ago

Hi @fabio-muramatsu, Can we know if you are seeing this issue still and requires further follow up.

klenium commented 2 years ago

As far as I see this is replaced. The next 5 trigger dates are not displayed anymore, and when the trigger is fired, the date is displayed with the timezone info, which makes it clear.

v-bbalaiagar commented 2 years ago

Hi @mathewc / @fabiocav , Could you please look into this issue