Have you find a way to solve this timeout error or why is it happening?
Azure Function returns Timeout after 1 minute but code executes successfully
I have an HTTP-Triggered Azure Function using Python 3.9 runtime that does some reading from key-vault and writing to a database. The whole process usually takes 40-70 seconds and in some cases even less. I invoke this function from .NET using an http request to the URL of the function and I need to wait for the result for further branching inside the .NET code. So this Azure Function returns me a Timeout error after slightly one minute, sometimes even says that the Service went down even though I can still see it up and running and I can execute more calls. The funniest part of this is that, I get an error that either service is down or timeout error but the code from the function executes and I can see it clearly from the logs that everything goes as it should go. I'm not sure whether this is something that I, as a developer should fix or the function as a service is just unstable and it makes these funny things. Another thing I'd like to note is that I haven't set any timeout value in host.json so I assume it uses the default one of 230 seconds.
I dig up the whole internet but couldn't find what could cause this so that's why I chose to ask here. TLDR of the whole thing would be, why does my app return a timeout error or a 503 (service down) error after one minute of running but the code inside the function executes so it tricks my client app (the one that triggers the function) in thinking that the request failed, even though it didn't? What should I make in order to fix this error?
Azure Functions
3 answers
Sort by: Most helpful
-
-
Banchio 0 Reputation points Microsoft Employee
2023-09-07T14:59:09.2466667+00:00 Got here for the same issue, discovered that 60 secs is the default timeout for FastAPI. Needed to change that by using the following:
app = fastapi.FastAPI(timeout=120)
Timeout is in sec. HTH!
-
Michel Tsukiyama de Souza 0 Reputation points
2024-06-10T20:36:47.07+00:00 Hi,
I solved my trouble, and as there is a possibility it could happen to anyone else, I will explain what happened:
My Azure function in the "A" API was making an HTTP request to the Azure function in the "B" API endpoint. I noticed that when I made the HTTP request to https://'myfunction'.azurewebsites.net (Azure Domain), I did not get a timeout response, but when I made the HTTP request to https://'mydomain'.com (another provider's domain), I got a timeout after 60 seconds.
In my case, it was not related to the Azure Functions but to the domain provider. I suggest you check if it's not related to any other service or provider.