microsoft / azure-container-apps

Roadmap and issues for Azure Container Apps
MIT License
372 stars 29 forks source link

Azure Function Timer trigger doesn't invoke accordingly to cron expression #1320

Closed kmadof closed 1 month ago

kmadof commented 1 month ago

Issue description

I have Azure Function written in F# (dotnet 8) deployed to Container App Environment with function trigger as below

module TimerFunctions =
    [<Function("TimerFunction")>]
    let Run ([<TimerTrigger("0 0 * * * *")>] timer: TimerInfo, log: ILogger) =
        Console.WriteLine("================== Hey, I am a 'TimerFunction'. I am really lazy, so I only print to console ==================")

Sometimes this function is not invoked.

My function is scaled to 0, but this should not be an issue for this trigger

While all triggers can be used, only the following triggers can dynamically scale (from zero instances) when running in a Container Apps environment:

  • HTTP
  • Azure Queue Storage
  • Azure Service Bus
  • Azure Event Hubs
  • Kafka
  • Timer

Expected behavior [What you expected to happen.] I expected to have this function executed according to the cron expression.

Screenshots
Image

Additional context

Here are version of packages I use:

    <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.18.1" OutputItemType="Analyzer" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.3.1" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="5.22.0" />
simonjj commented 1 month ago

@kmadof thank you for reaching out. When you mention that executions got skipped you meant 17/10 6,7 and 9am as examples?

raorugan commented 1 month ago

Hi @kmadof , I am sorry about the issue you have faced. This is not expected behaviour of the trigger. It can scale from and to zero. May I ask you raise an issue here in the functions github repo - https://github.com/Azure/azure-functions-on-container-apps/issues

kmadof commented 1 month ago

@kmadof thank you for reaching out. When you mention that executions got skipped you meant 17/10 6,7 and 9am as examples?

Yes, that's my point.

Hi @kmadof , I am sorry about the issue you have faced. This is not expected behaviour of the trigger. It can scale from and to zero. May I ask you raise an issue here in the functions github repo - https://github.com/Azure/azure-functions-on-container-apps/issues

Yes of course!

kmadof commented 1 month ago

Here is the link to the new issue

anthonychu commented 1 month ago

We'll track this in the other issue. Closing this one.