azureazure-devopsazure-functionsazure-pipelinesazure-yaml-pipelines

Azure pipeline doesn't wait for function app to complete


I got a function app which can have a very long running operation. I am triggering it with an Azure yaml pipeline like this:

- task: AzureFunction@1
  displayName: Run Dummy function
  inputs:
    function: '$(FunctionURL)/api/DummyFunction'
    key: '$(FunctionKey)'
    method: 'POST'
    body: $(AzureFunctionBody)        
    waitForCompletion: 'true'

Every time I run the pipeline, it fails with an error message:

            > Response Code: 0
            > Response: An error was encountered while processing request. Exception: 
            > Exception Message: The request timed out after 60 seconds as no response was received. (type TimeoutException)

Even though I get an exception in the pipeline, the function app itself is being triggered and fully runs without any issues.

How can I make the pipeline wait for the function app to finish, even if it means waiting for hours?


Solution

  • How can I make the pipeline wait for the function app to finish, even if it means waiting for hours?

    You can use the job timeout setting to specify the limit in minutes for running the job - example:

    jobs:
    - job: Deploy
      timeoutInMinutes: 0
      steps:
        # ...
    

    Setting the value to zero means that the job can run:

    If the Azure function executes for more than 1 minute, use the Callback completion event. Property waitForCompletion must be set to true. See Example of an Azure Function that uses the callback completion mode.