0

I have a python function in Azure that runs every ten minutes. Different from these similar issues that I've been looking at, or this post from Azure, my function doesn't matter what time zone it is synced to, but it never runs at all. enter image description here

I assume that in the last thierty days it would have run. If there was an issue with my code , it would have errored. It hasn't done anything in a month. If it had run, but errored then there would be logs to look at but there aren't.

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "name": "mytimer",
      "type": "timerTrigger",
      "direction": "in",
      "RunOnStartup":true,
      "schedule": "0 */10 * * * *"
    }
  ]
}

The function should run at least once but doesn't. The function runs fine when run locally, and deploys to Az from Visual Studio Code.

enter image description here

The Function is set to "Always on".

What else could I possible check? Note that the functions did run before my recent update, which led me to believe that there might be something with the code, but it isn't that the code is crashing, it's that it's never executing.

You can see that it's configured to run per the docs: enter image description here

Here are my environ settings:

[
    {
      "name": "AzureWebJobsStorage",
      "value": "DefaultEndpointsProtocol=https;AccountName=exodestinyblob;AccountKey=1234EndpointSuffix=core.windows.net",
      "slotSetting": false
    },
    {
      "name": "BUILD_FLAGS",
      "value": "UseExpressBuild",
      "slotSetting": false
    },
    {
      "name": "ENABLE_ORYX_BUILD",
      "value": "true",
      "slotSetting": false
    },
    {
      "name": "FUNCTIONS_EXTENSION_VERSION",
      "value": "~4",
      "slotSetting": false
    },
    {
      "name": "FUNCTIONS_WORKER_RUNTIME",
      "value": "python",
      "slotSetting": false
    },
    {
      "name": "SCM_DO_BUILD_DURING_DEPLOYMENT",
      "value": "1",
      "slotSetting": false
    },
    {
      "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
      "value": "DefaultEndpointsProtocol=https;AccountName=exodestinyblob;AccountKey=1234;EndpointSuffix=core.windows.net",
      "slotSetting": false
    },
    {
      "name": "WEBSITE_CONTENTSHARE",
      "value": "exo-1234",
      "slotSetting": false
    },
    {
      "name": "WEBSITE_HEALTHCHECK_MAXPINGFAILURES",
      "value": "10",
      "slotSetting": false
    },
    {
      "name": "XDG_CACHE_HOME",
      "value": "/tmp/.cache",
      "slotSetting": false
    }
  ]
billmanH
  • 1,298
  • 1
  • 14
  • 25
  • 1
    Can you change the `RunOnStartup` to false and check once. – Harshitha Aug 17 '23 at 10:59
  • Yeah, I've toggled it back and fourth. Seems to not execute either way. I Set it to `RunOnStartup` just to see if it would run at least once. It didn't. – billmanH Aug 18 '23 at 18:40

1 Answers1

-1

It is not advised to use runOnStartup as true. When run on these setting code execution is unpredictable. As mention in the Microsoft document, for refernce check this document
few snippets from the document as shown below: enter image description here

enter image description here

Reproduced timer trigger in my environment "timetest" which runs every 10 minute which prints "Hello World".

Tried in both settings with "runOnStartup as true" and without. It is working fine both locally and on Azure both as shown below: Locally:

Without "RunOnStartup":

enter image description here

enter image description here

enter image description here

With "RunOnStartup":

enter image description here

enter image description here

enter image description here

As you can see below with "runOnStartup" as "true" running on unpredictable time even though it is set to run on every 10 minutes. 2nd time It ran after 4 minutes. 3rd time after 2 minutes.

enter image description here

If you are still facing the issue, I would Suggest please reach out to Azure Support for further assistance.

  • Yeah, but that doesn't explain why the function never runs at all. Plus, as noted, setting it true or false doesn't matter. It never executes. – billmanH Aug 23 '23 at 12:54
  • Will Check and update the Answer accordingly. Could you please share your function code, function runtime version and setting available in environment variables-> app settings? – Vivek Vaibhav Shandilya Aug 26 '23 at 04:55
  • 1
    Settings in environment variables [image](https://i.imgur.com/li02tZy.png) – Vivek Vaibhav Shandilya Aug 26 '23 at 05:03
  • The full code for the function is here: https://github.com/BillmanH/exoplanets/tree/main/functions/time – billmanH Aug 26 '23 at 15:48
  • I've added the environment settings as well – billmanH Aug 26 '23 at 15:56
  • 1
    Please check **Diagnose and solve problems** blade of your function in azure portal to know why the timer trigger function app is not getting triggered. Check **Diagnose and solve problems->Availability and Performance->Functions that are not triggering** to know more details and recommendations on the error. [Image1](https://i.imgur.com/0yg7Bzz.png)->[Image2](https://i.imgur.com/vYQ2aih.png) – Vivek Vaibhav Shandilya Aug 30 '23 at 06:08
  • I notice that the suggestion is just `Please restart the Function site manually or redeploy the function site to get the issue mitigated or use the AppOffline History detector to check if the function was offline during this period.`, which is the same as "turn it off and on again and see if that fixes the problem". That's not very reassuring. Also, I've done that a bunch of times and it doesn't seem to be fixing the issue. – billmanH Aug 31 '23 at 02:35