OPEN TO WORK

Available for new opportunities! Let's build something amazing together.

Why does your timer trigger Azure Function run at unforeseen times?

Azure Functions Azure
post

This post is over a year old, some of this information may be out of date.

Why does your timer trigger Azure Function run at unforeseen times?

Has it ever happened that your timer triggered Azure Function was running on unforeseen times? We had it for two functions, and could not immediately find out where or why this was triggered more than once an hour.

Show image Timer function running multiple times per hour
Timer function running multiple times per hour

One of the functions should run once every hour, but as you can see, sometimes it runs more. Between 10-11, it ran three times.

What is the issue?

While checking the timer function documentation, I saw this alert about the runOnStartup property:

Show image runOnStartup property warning
runOnStartup property warning

Info: Due to this property, our function automatically started each time the service was restarted, scaled out, … Documentation can be found here: Timer trigger for Azure Functions documentation.

The solution

As the documentation specifies, you should not use this functionality in production. Best is to remove this property or set it to false.

Show image Timer function running only once an hour after updating the property
Timer function running only once an hour after updating the property

It might be that in some cases, you want this kind of functionality. In that case, you can leave it as is, and then you know why it happens.

Related articles

Report issues or make changes on GitHub

Found a typo or issue in this article? Visit the GitHub repository to make changes or submit a bug report.

Comments

Elio Struyf

Solutions Architect & Developer Expert

Loading...

Let's build together

Manage content in VS Code

Present from VS Code