Azure-Functions icon indicating copy to clipboard operation
Azure-Functions copied to clipboard

TimerTrigger attribute using TimeSpan format works locally but fails when deployed

Open garthmason opened this issue 9 years ago • 6 comments

I've noticed that I can build/run/debug a Timer triggered Azure function in the VS2017 Preview tooling where the timer binding uses a timer schedule specified as a TimeSpan.

E.g in local.settings.json for my Azure functions project I specified "RefreshInterval": "01:00:00" and then use it in my function trigger binding like this

[FunctionName("MyRefreshFunction")] public static void Run([TimerTrigger("%RefreshInterval%", RunOnStartup = true)] TimerInfo myTimer, TraceWriter log, ..

This all works fine locally but when I deploy this function project to Azure the functions fail as they are expecting only a CRON expression for the timer schedule parameter.

Is this expected behaviour? I can revert back to CRON expressions for now, but I'd expect that if I can configure it this way locally I should be able to do the same when it's deployed.

garthmason avatar May 24 '17 03:05 garthmason

You can only use TimSpan expressions if you're running on an App Service plan. However, we should improve the error message to reflect that.

lindydonna avatar Jun 01 '17 00:06 lindydonna

Ah yes, I am using the consumption plan. I picked up on the TimeSpan option by looking at the TimerTrigger attribute definition (see image). Improved error message sounds good to me 👍

image

garthmason avatar Jun 01 '17 01:06 garthmason

Yes, I think we should also update the doccomment in TimerTriggerAttribute to make it clear that TimeSpan is not supported on the Consumption plan.

lindydonna avatar Jun 01 '17 01:06 lindydonna

See https://github.com/Azure/azure-webjobs-sdk-script/issues/1561 for improving the error message.

I'll put out a PR shortly to improve the doccomment. Closing this issue.

lindydonna avatar Jun 01 '17 01:06 lindydonna

@garthmason See https://github.com/Azure/azure-webjobs-sdk-extensions/pull/231.

lindydonna avatar Jun 01 '17 01:06 lindydonna

Great, appreciate the quick response we are getting to theses issues!

garthmason avatar Jun 01 '17 01:06 garthmason