The error you're seeing, "ActionResponseTimedOut," happens because Power Apps has a strict limit on how long it will wait for a response from a flow. Specifically, it only waits for 2 minutes. In your case, the HTTP step in your flow is taking about 5 minutes to complete, which is much longer than Power Apps allows. So even though the flow eventually finishes, Power Apps has already stopped waiting and throws a 504 Gateway Timeout error.
To fix this, you have a few options depending on how critical it is to get a response immediately.
1. Redesign the flow to run in the background:
Instead of waiting for the HTTP request to finish, you can restructure your flow so it returns a response to Power Apps right away. Then let the rest of the flow run in the background. You can store the result somewhere like SharePoint or Dataverse, and either notify the user later or have them check the status separately.
2. Try to speed up the HTTP request:
If possible, look at the service you're calling in the HTTP step. See if there's any way to reduce the response time—maybe by optimizing the query, filtering the data earlier, or removing unnecessary steps.
3. Use a child flow (if you have premium access):
If your license includes premium connectors, you can break the long-running part into a separate child flow. That way, your main flow can return to Power Apps immediately and continue processing in the background.
4. Move the long process to a Logic App:
If you're working with long-running operations frequently, consider using an Azure Logic App. It can handle longer durations more easily than Power Automate when triggered from Power Apps.
If this is just for testing, you could temporarily replace the HTTP action with a faster mock call just to confirm everything else works.
This is a Power Apps limitation, not Power Automate. Even if the flow succeeds later, Power Apps times out at 2 minutes and cannot receive the result.