Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Answered

PowerApps File Upload Fails Over 20MB via Power Automate: Error 502

(0) ShareShare
ReportReport
Posted on by 10

Hi everyone,

I am working on a PowerApps Canvas App where users should upload attachments using the Attachment Control. The uploaded files are in the format of pdf or zip and I store them in a Share Point document library using a Power Automate flow. (File name and content are sent to Power Automate via a Power Apps trigger)

Issue:

  • I have set the MaxAttachmentsSize property to100MB,
  • However, the upload fails when trying to upload files larger than ~20 MB - In fact the flow is not triggered with large files and throw the error below: "error": {
    "code": 502,
    "source": "d89a820b-2095-...d101b318.04.common.usa002.azure-apihub.net",
    "clientRequestId": "5cf96e59-dd2...fcf-5e8342655d16",
    "message": "The response is not in a JSON format.",
    "innerError": "Cannot read server response."
    }
    }

Questions:

  1. Why does the upload fail at ~20MB even though Power Automate supports larger files?
  2. Is there a workaround to allow users to upload larger files?
  • MehranDov Profile Picture
    10 on at
    PowerApps File Upload Fails Over 20MB via Power Automate: Error 502
    Unfortunately, no. I tried editing the code you provided in various ways, but it didn’t work. The only workaround I’ve found so far is using Office365Groups, which I’m not comfortable with. For now, I’ve set the file size limit in the app to 25MB and am still looking for an optimal solution.
  • WarrenBelz Profile Picture
    148,805 Most Valuable Professional on at
    PowerApps File Upload Fails Over 20MB via Power Automate: Error 502
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • Verified answer
    WarrenBelz Profile Picture
    148,805 Most Valuable Professional on at
    PowerApps File Upload Fails Over 20MB via Power Automate: Error 502
    Yes - you need to strip out the Header and also the leading and trailing quotes - so
    With(
       {
          _File: 
          With(
             {
                _JSON: 
                JSON(
                   First(DataCardValue3.Attachments).Value,
                   JSONFormat.IncludeBinaryData
                )
             },
             Mid(
                _JSON,
                Find(
                     ",",
                   _JSON
                ) + 1,
                Len(_JSON) - 
                Find(
                   ",",
                   _JSON
                ) - 1
             )
          )
       },
       JSON_Test_flow.Run(
          First(DataCardValue3.Attachments).Name,
          _File
       )
    )
    The code you have in the Flow should work on this.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • MehranDov Profile Picture
    10 on at
    PowerApps File Upload Fails Over 20MB via Power Automate: Error 502
    Thanks @WarrenBelz for your time. 
    I tried multiple ways to implement your JSON conversion suggestion but I'm getting the resource reference issue. Here's one of the codes I used:
     
    Power Apps side:
    // 1. Convert the attachment to JSON string (with Base64)
    Set(
    varEncodedFile,
    JSON(
    First(DataCardValue3.Attachments).Value,
    JSONFormat.IncludeBinaryData
    ));

    JSON_Test_flow.Run(
    First(DataCardValue3.Attachments).Name,
    varEncodedFile);
     
    Power Automate side:
    I have a Compose control after Power apps (V2) trigger with the following expression:
    base64ToBinary(triggerBody()?['text_1'])
     
    However, Power Automate is receiving the content as "appres://blobmanager/ba73eed30c48412ead7d4419566c3586/1" instead of the actual binary data and fails. (ERROR: 
    InvalidTemplate
    Unable to process template language expressions in action 'Compose' inputs at line '0' and column '0': 'The template language function 'base64ToBinary' was invoked with a parameter that is not valid. The value cannot be decoded from base64 representation.'.
     
    It seems PowerApps is sending the resource reference rather than the file content itself. Any thoughts on how to force PowerApps to load the actual binary data before sending it to the flow?
  • WarrenBelz Profile Picture
    148,805 Most Valuable Professional on at
    PowerApps File Upload Fails Over 20MB via Power Automate: Error 502
    I assume you are sending the "raw" binary file using the Power Apps V2 connector - from some quick research, it appears Power Automate may not be able to consume that amount of binary data. Try converting it to JSON and then back again in the Flow.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1