question

BengtMossPetersen-3419 avatar image
0 Votes"
BengtMossPetersen-3419 asked BengtMossPetersen-3419 edited

Durable function returns 503 ServiceUnavailable to Power Automate flow on large requests

I'm requesting a durable function (Azure function) from a Power Automate flow. The request includes a ZIP file. If this ZIP file is as large as 20MB, the following happens:

  1. The flow receives a 503 ServiceUnavailable message almost immediately

  2. After the time expected for the operation,
    the Azure function log shows that the durable function's orchestrator returns the value that indicates success
    and the function has indeed created the artefacts it should create.

This doesn't happen with requests as small as 5.5MB. I have not tried to find the 'pain point' in between 5.5 and 20MB.
For comparison, I have included this large ZIP file in a request to a 'plain' Azure function HTTP trigger and did not get a 503 or any other error message.

I can't find anything in the log that indicates at which point in the process the 503 error is returned to the client.
Below is the code of the 'starter' function.

Does anyone know what is the cause of this error, or if it can be prevented?

         [FunctionName(nameof(MyDurableClient))]
         [Produces("application/json")]
         [Consumes("multipart/form-data")]
         public async static Task<IActionResult> MyDurableClient(
             [HttpTrigger(AuthorizationLevel.Anonymous, "post")]
             HttpRequest req,
             [DurableClient] IDurableOrchestrationClient starter,
             ILogger log)
         {
             ActionResult result;
             try
             {
                [left out for brevity]
                 byte[] templateZipFile = null;
                 IFormFile formFile = req.Form.Files["file"];
                 if (formFile.Length == 0)
                 {
                     throw new ControllerException("Empty template ZIP file");
                 }
                 using (var ms = new MemoryStream())
                 {
                     formFile.CopyTo(ms);
                     templateZipFile = ms.ToArray();
                 }
                 log.LogInformation("ZIP retrieved from multipart request form.");
                 string instance = await starter.StartNewAsync<Tuple<Ticket, ProvisionOptions, byte[]>>(nameof(My_Orchestrator), new Tuple<Ticket, ProvisionOptions, byte[]>(ticket, options, templateZipFile));
    
                 return AsyncApiController.CreateAcceptedStatusResponse(req, log, instance);
             }
             catch (Exception ex)
             {
                 log.LogError(ex, ex.Message);
    
                 result = new ObjectResult(
                new ProblemDetails()
                {
                    Title = ex.Message,
                    Type = ex.HelpLink,
                    Detail = ex.ToString()
                })
                 {
                     StatusCode = StatusCodes.Status400BadRequest
                 };
    
             }
             return result;
         }


dotnet-csharpazure-functions
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

LeonLaude avatar image
1 Vote"
LeonLaude answered BengtMossPetersen-3419 edited

Hi @BengtMossPetersen-3419,

Please note that Power Automate is currently not supported in the Q&A forums, the supported products are listed over here https://docs.microsoft.com/en-us/answers/products.

You may ask the experts in the dedicated Power Automate forum over here:
https://powerusers.microsoft.com/t5/Microsoft-Power-Automate/ct-p/MPACommunity

If your question is more related to Azure Functions, you can change the tag to: azure-functions


If the reply was helpful please don't forget to upvote and/or accept as answer, thank you!


Best regards,
Leon

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @LeonLaude,
Thanks for this clarification, I will ask in the Power Automate forum and hope they don't dismiss the question as Azure Function-related ;-)
However, apart from how Power Automate handles the 503 response, the question is essentially still about the behavior of durable functions:
Why do large requests provoke a 503 response?
Thanks.

0 Votes 0 ·