Long Interval Timer Trigger Function not firing on Consumption Plan

Adrian Hills 21 Reputation points
2022-04-26T10:58:09.513+00:00

Hi,

Background:
I have an Azure Function timer trigger that kicks off a durable function orchestration. This goes on to check if a file is waiting to be processed - and if so, does a bunch of processing on it. The file could appear more or less at any point during the day.

Setup:

  • Timer trigger is set with this schedule: 0 30 7-23/2 * * Tue (every 2 hours between 7am and 11pm, at 30 minutes past the hour)
  • Azure Functions V3, .NET
  • Deployed to a Linux Consumption Plan

Issue:
For 6 days of the week, the app does nothing so will scale down to zero instances. When it comes round to Tuesday, the schedule does not fire. If I go into the Azure Portal for the function, this is enough to nudge it and the schedule then fires and does the processing as expected.

I went with Consumption Plan as this service only has some real work to do once per week, and when it does, it needs to scale-out to churn through as quickly as possible, before then scaling back down to zero. SO I didn't want to use an App Service Plan/Dedicate Plan when most of the time it's dormant.

Is this expected behaviour with timer triggers on consumption plan?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,320 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Adrian Hills 21 Reputation points
    2022-05-03T08:56:02.783+00:00

    Confirmed it was the issue - the schedule fired successfully as expected on the next due run.

    So to recap -
    CAUSE: when running on a Linux consumption plan and using bindings for settings in the trigger that are nested. It fails to resolve them.

    SOLUTION: Don't nest the settings

    EXAMPLE:
    Fails:

    public async Task Run([TimerTrigger("%SomeRoot:PollingSchedule%")] TimerInfo timer, ILogger log)
    

    Works:

    public async Task Run([TimerTrigger("%PollingSchedule%")] TimerInfo timer, ILogger log)
    
    1 person found this answer helpful.

  2. AnuragSingh-MSFT 20,431 Reputation points
    2022-04-27T06:54:58.997+00:00

    Hi @Adrian Hills

    Welcome to Microsoft Q&A! Thanks for posting the question.

    I see that your deployed timer triggered Function App is not running as expected on scheduled time. Since you are using Consumption Plan, please note that Azure Function App might take a while to do the cold start. One of the way to verify that would be to wait for a couple of minutes after the scheduled start and see if it runs.

    The other most common cause for Azure Functions not getting triggered is that triggers are not synced properly. You can sync triggers in one of three ways:

    • Restart your function app in the Azure portal
    • Send an HTTP POST request to https://{functionappname}.azurewebsites.net/admin/host/synctriggers?code=<API_KEY> using the master key.
    • Send an HTTP POST request to https://management.azure.com/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP_NAME>/providers/Microsoft.Web/sites/<FUNCTION_APP_NAME>/syncfunctiontriggers?api-version=2016-08-01. Replace the placeholders with your subscription ID, resource group name, and the name of your function app.

    More details available here: Trigger syncing
    You may also refer to this blog by Ken Muse about this issue - Function Trigger Syncing

    In case you are still facing this issue, the wiki article below should help to investigate it further - Investigating and reporting issues with timer triggered functions not firing

    ---
    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.