How often do you need to do something complicated in Power Apps and you use Flow to do this for you? Long running flows can cause problems.

When this something takes longer than a minute you might run into issues. These long running flows called from Power Apps will time out after one minute. The Power Platform can handle long running flows, however when you call them from Power Apps you might have to do some additional work.

During one of my projects I recently ran into the issue where the flows would sometimes take longer than 1 minute. Then as I tested the solution I also found that you get the same error when you close the app before the flow has finished.

Long running flows

As a test I created a flow that simply waits for 2 minutes and then I called it from a Button or a Timer in Power Apps and in both cases I received the following failure

The execution of template action ‘Respond_to_a_PowerApp_or_flow’ is failed: the client application timed out waiting for a response from service. This means that workflow took longer to respond than the alloted timeout value. The connection maintained between the client application and service will be closed and client application will get an HTTP status code 504 Gateway Timeout.

In my case I was able to optimise the flow a bit and the problem went away. Of course it doesn’t stop the user from closing the Power App. So you might need to add some error handling on the Respond to a PowerApp or flow action.

How to optimize your flows?

Improve your flow’s performance in a few easy steps

Use 1 Parse JSON action to validate data

Microsoft Flow – Single item nested arrays

1 Flow Performance tip to get your flows out of the stone age

Share
Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

View Comments

    • Hi Heli,

      In general flows shouldn't run very long. Splitting up flows or using any of the optimization steps that I have blogged about should help.

      Can you give some details on what your flow is doing.

      I will include some links to Power Automate optimization posts in this post.

    • Hi Joe,

      This is one of the reasons why in general RPA isn't a great idea. It doesn't give you the finer control that the classic flows give you. In general using APIs rather than RPA is quicker and more reliable.

  • I have a JSON that has 1000+ rows. the ForEach is taking over an hour to update excel sheet. what can be done to speed this process up and respond before timing out in powerapps waiting for response.

  • First Peter: Thank you for all your posts (very informative). If one gets to large of arrays to GRAPH there is a HTTP timeout issue that comes up on this. Thus how would one go about best splitting the data into decent sided batches.

    • I would probably look at creating filters on the MS Graph call. Most likely i would do this by creating a custom connector that way configuring the filters will become easier.

Recent Posts

Filter Query in SharePoint Get Items in Power Automate

Have you tried the experimental version of Filter query in the SharePoint Get Items action…

2 days ago

3 Ways to add a column to an array in Power Automate

When you have an array in Power Automate and you would like to add a…

6 days ago

Patch any field type in a SharePoint list item using Power Apps

In Power Apps the Patch function is very important when you work with data. In…

1 week ago

Call flows from a model driven app

Wouldn't it be great if you could call flows from a model driven app? Well…

2 weeks ago

Variables or Compose? Consider neither in Power Automate

The question is Variables or Compose actions in Power Automate? Variables Sometimes you need a…

2 weeks ago

Your 1st lesson in Power Apps, in a few easy steps!

1st lessons can be so important when you want to get started with Power apps.…

4 weeks ago
%%footer%%