HTTPTrigger Response Timeout

Chris Sawtelle 21 Reputation points
2022-03-03T22:54:48.217+00:00

I am working on an HTTPTrigger function that initiates a build and waits for the build to complete before responding with a status. However, sometimes the build takes longer than 4 minutes to complete, and in those cases I am receiving a 503 - Timeout error. Digging through the Azure Function documentation, I found this explanation:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-scale

Regardless of the function app timeout setting, 230 seconds is the maximum amount of time that an HTTP triggered function can take to respond to a request. This is because of the default idle timeout of Azure Load Balancer.

This indicates that this 4 minute timeout is due to the default idle timeout of the Azure Load Balancer even though my Resource Group and FunctionApp has no ties to any Azure Load Balancers. I assume this is some sort of built-in default configuration that the functions use when they execute.

My question is, can this idle timeout be configured in any way, or is this impossible to change? The documentation suggests using a Durable Function instead but before making any changes I wanted to see if it was possible to change this default behavior for an already existing Azure Function or FunctionApp.

Thanks!

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,911 questions
0 comments No comments
{count} votes

Accepted answer
  1. MughundhanRaveendran-MSFT 12,506 Reputation points
    2022-03-04T13:25:41.447+00:00

    @Chris Sawtelle ,

    Thanks for reaching out to Q&A.

    As mentioned in the article, there is a 4 minute default idle timeout at the Azure load balancer called Front end server. This front end server is a part of Http triggered function architecture and the timeout has been set to 4 minutes for security purposes (Ex: preventing Ddos attacks etc. ). The front end is a layer seven-load balancer, acting as a proxy, distributing incoming HTTP requests between different applications and their respective Workers.

    Http triggered Function architecture on highlevel:

    180128-front-end.png

    Unfortunately there is no way to disable/configure/change the default idle timeout value of the Front end due to the above stated facts.

    When a client application is calling a http triggered function app and the function app is taking more than 4 minutes to respond and it times out. In this case, the function app can be replaced with durable functions as the durable function would return a 202 accepted response to the client as soon as it receives a request and the durable function would keep executing.

    I hope this helps!

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

    3 people found this answer helpful.
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Bruno Lucas 6 Reputation points
    2022-03-04T03:18:56.6+00:00

    Hi, You mentioned "Resource Group and FunctionApp has no ties to any Azure Load Balancers"

    What type of service plan are you using?

    Did you try the FunctionTimeout under the host.json

    {
    "version": "2.0",
    "functionTimeout": "00:10:00",
    "logging": {
    "applicationInsights": {
    "samplingSettings": {
    "isEnabled": true,
    "excludedTypes": "Request"
    }
    }
    }
    }

    This seems to work on the VS emulator but not on real Function Aps. Would be good if Microsoft would clarify that on their documentation. I tried the same code that works on emulator and it failed exact after 230 seconds in both "Consumption" and "Premium"

    179961-image.png

    I think this forced 230s applies to HTTP Request only. Microsoft Documentation can be confusing for Azure Functions
    179981-image.png

    if you see this example of the host file, they added all params in one file. I know not all of them apply for every type of trigger but they don't clarify that here:
    https://learn.microsoft.com/en-us/azure/azure-functions/functions-host-json

    1 person found this answer helpful.
    0 comments No comments

  2. Bruno Lucas 4,436 Reputation points MVP
    2022-03-04T08:57:21.747+00:00
    0 comments No comments

  3. Chris Sawtelle 21 Reputation points
    2022-03-04T15:35:01.11+00:00

    Thanks for the response. This was what I suspected was the case but it is helpful to see it confirmed with an explanation why. Thank you for the help!

    0 comments No comments

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.