Timer Function returns 404 on consumption plan. cronjob but http fn invokes ok

ozbobwa 21 Reputation points
2024-07-09T03:41:19.5333333+00:00

Timer function returns 404 from both postman and Az Portal test/run.

Http function executes from Postman and from Az Portal test/run, OK.

  • App is deployed from GitHub Action. I have used Restart and Refresh but cron job does not fire.
  • Publishing model: Code
  • Runtime Stack: .NET - v6.0
  • Runtime: ~4
  • Not set WEBSITE_TIME_ZONE
  • CRON expression: "0 6 * * *"
  • Plan Type: App Service plan
  • Operating System: Windows
  • SKU and size: Dynamic Y1

Log of Deployment:

  1. ...
  2. Triggering recycle (preview mode disabled).
  3. Deployment successful.
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,835 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,798 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ozbobwa 21 Reputation points
    2024-07-23T02:31:52.0933333+00:00

    nCRON is NOT the same as CRON expressions.

    CRON expressions work in debug local development, but do NOT work in Azure Portal.

    Upgrade expression to satisfy these rules with SIX space seperated digits/sub-expressions :

               nCRON JOB DATA:
               Each cronjob has the following syntax:
               * * * * * *
               - - - - - -
               | | | | | |
               | | | | | +--- day of week (0 - 6) (Sunday=0)
               | | | | +----- month (1 - 12)
               | | | +------- day of month (1 - 31)
               | | +--------- hour (0 - 23)
               | +----------- min (0 - 59)
               +------------- sec (0 - 59)
              More details here:  https://github.com/atifaziz/NCrontab
    

    MSLearn Azure Function nCron examples:

    0 5 * * * * //Once every hour of the day at minute 5 of each hour
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.