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

Bengt Moss-Petersen 1 Reputation point
2021-06-26T12:49:29.517+00:00

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;
        }
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,208 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,194 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Leon Laude 85,646 Reputation points
    2021-06-26T13:09:57.843+00:00

    Hi @Bengt Moss-Petersen ,

    Please note that Power Automate is currently not supported in the Q&A forums, the supported products are listed over here https://learn.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 person found this answer helpful.