0

I am trying to Post a data that is more than 4 MB (4096 Bytes) to the Azure function using HTTP Trigger.

It is timing out . Following is my code in Azure function

public static class SampleFunction { [Function("SampleFunction")] public static async Task Run([HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestData req, FunctionContext executionContext) {

        using (var ms = new MemoryStream())
        {
            

            await req.Body.CopyToAsync(ms);               
            
            ms.Position = 0;
            var streamContent = new StreamContent(ms);


            //..PRocess the file
        }


    }
}

}

I am using Postman as client with following configuration :

Postman configuration

The test file of 4 MB

I checked the Microsoft doc https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=csharp

It refers to 100 MB limitation. Please let me know, what mistake I am doing ?

SaiSakethGuduru
  • 2,218
  • 1
  • 5
  • 15
  • Your postman screenshot shows 500 status code(that means code error), not a timeout(408). Is your http trigger method being hit when you place breakpoints ? – Shyju Aug 07 '21 at 20:06
  • The postman screen shot was to show the configuration. Please ignore the Status code. – user13616669 Aug 08 '21 at 09:14
  • I tried your sample code and i do not get 408. Have you tried putting breakpoints in your method and see that is being hit ? Also, what does "process the file does" ? Is it possible that that part is taking forever and times out ? – Shyju Aug 08 '21 at 16:54
  • Thanks for trying it out. Have you used input file size more than 4 MB (4096 Bytes) ? When I did , the Azure function .Net 5 never got invoked. Please let me know , your findings and share the settings – user13616669 Aug 08 '21 at 23:22
  • Are you running into [this issue](https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=csharp#limits) specified in the docs ? *If a function that uses the HTTP trigger doesn't complete within 230 seconds, the Azure Load Balancer will time out and return an HTTP 502 error* – Shyju Aug 09 '21 at 00:35
  • I was under the impression that you have tried my sample code and posted file size > 4 MB. Please try it and let me know the answer. I am aware that HTTP trigger has time limit. For any file < 4MB (even 3.9 MB) my logic gets executed within 10 secs. – user13616669 Aug 09 '21 at 06:16

0 Answers0