Wednesday, October 21, 2020

Debugging Azure Timer Functions

Azure Timer Functions are great way to run your scheduled jobs and may be process data, or send a summary email likewise. One of the questions I received during a session was how do we trigger them when testing. This can be done in two ways. 

1. Set Cron Expression to pick up the next minute

If you set the following Cron expression, it will trigger on exact same minute. In this example, on 42nd minute. So whenever you debug you can set the next minute or two and then let it trigger and debug them. 


2. Send a Post request 


Timer functions has an admin endpoint. As you can see, the endpoint is in format of <Url>/admin/functions/FunctionName. 

Once you send a POST request, it will trigger and execute in the sequence. 


Understanding IsPastDue

Your function might be overdue to run due to various reasons including the App Server Restarts. In such. scenarios a IsPastDue flag is returned. This can be used in your logic depending on your needs such as running only if needed for the current hour. 

This can happen if previous run is failed as well. Can be very handy when debugging as you do not need to trigger externally.






1 comment: