504 Gateway Time-out - Azure function

Obaid UrRehman 171 Reputation points
2022-05-18T08:11:49.797+00:00

Hi,

I have an azure function that was working properly till yesterday. But now I am getting this error:

203085-timeout.png

I already tried increasing the HTTP request timeout from 1 min to 5 mins:
203096-image.png

Can someone please help?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,911 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,624 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. KranthiPakala-MSFT 46,642 Reputation points Microsoft Employee Moderator
    2022-05-18T22:07:26.217+00:00

    Hello @Obaid UrRehman ,

    Thanks for the question and using MS Q&A platform.

    The error `504 Gateway Time-out' usually occurs when your Azure Function takes more than 230 seconds to return a response. Azure Functions activity times out after 230 seconds regardless of the "functionTimeout" setting you've configured in the settings. In case if your Azure function takes more than 230 seconds to return a response, you may work around this behavior by following an async pattern or use Durable Functions. The benefit of Durable Functions is that they offer their own state-tracking mechanism, so you won't have to implement your own. S

    Here is the document for reference: https://learn.microsoft.com/en-us/azure/data-factory/control-flow-azure-function-activity#timeout-and-long-running-functions

    203259-image.png

    Since it used to work until yesterday and started failing suddenly, I would recommend to check the response time of your Azure function when it was successful v/s with the failed ones. If it is taking more than 230 seconds and failing, then we can conclude that as the root cause and you may implement the above mentioned workaround to avoid this in future.

    Ref doc: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=in-process%2Cfunctionsv2&pivots=programming-language-csharp#limits

    203341-image.png

    Hope this info helps.

    1 person found this answer helpful.

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.