@Admin Banuka Thanks for reaching out. It seems like the issue is caused by the backend service taking too long to respond, which is causing the Azure APIM connector in the Logic App to time out and return a 504 error to the Logic App client. The APIM backend is taking all the time and APIM is just waiting for it, which is resulting in a "ClientConnectionFailure" error.
There are two options to resolve this issue:
- Logic App timeout can be increased from the current to 120 second timeout max as per this doc https://learn.microsoft.com/en-us/azure/logic-apps/edit-app-settings-host-settings?tabs=azure-portal#managed-connector-operations. This may give more time for the backend service to respond and prevent the timeout error.
- You can filter down the query that you're sending to APIM, which should result in a smaller data set and quicker response time. This may help to reduce the backend time and prevent the timeout error.
Let me know if you have any other questions or concerns.