0

I have a logic app that gets called from APIM > Function > Logic app > D365 (synchronous call based on http request trigger). When I call it the first time (after a day, or after a few hours), takes longer than usual (around 25-30 seconds) and results in a Gateway timeout error.

When I call it the second time, it usually completes the operation within 8-10 secs with no timeouts.

The error message is typical: The execution of template action 'Response_-_to_be_displayed' 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.

While keeping the pattern synchronous, i don't think this is something that may cause a timeout issue. I have already checked this link and this one too, but that's not a solution to my problem. I want to keep the call synchronous (it's only a 25-30 sec call), is it something to do with an APIM policy or any settings in logic apps that can increase this?

2
  • is the APIM connected to an Azure Function? if yes, please have a look at the Azure function cold start time. Commented Aug 23, 2022 at 21:12
  • I can see the logic app cold start time, how can I check for the function? Commented Aug 24, 2022 at 2:38

1 Answer 1

2
  • you can increase the timeout in both logic app and APIM. In the case of APIM we implement a policy, which will dictate the timeout and in logic app it's app settings.

  • But in case of APIM if the timeout is more than 240 sec then APIM won't be reliable, and it is advised to look for the implementation of the function.

  • Now to increase the timeout in APIM we must set up the forward request policy and this policy has the attribute of timeout which you can set to your desired limit.

  • Go to policy fragments in APIM and add the following to a policy

<forward-request timeout="60"/> 

enter image description here

  • Now regarding the logic-app, we can setup custom timeout by setting up application settings. For this you would need two setting one is threshold and other one is time out. you have to add these in app setting which is under configuration in portal for logic app.

  • The settings are called

Runtime.FlowRetentionThreshold

and

Runtime.Backend.FlowRunTimeout

the values of these settings are in format Days.hours:Minutes:seconds for example : 00.00:05:00 this one is for 5 minutes

enter image description here

  • Also please check that your function is working properly as workflow timeout in logic apps and apim timeouts default value is more than the time it takes to execute a task according to you.

Refer this msDoc on Logic app timeout

Refer this msdoc on apim timeout.

Sign up to request clarification or add additional context in comments.

1 Comment

the logic app timeout doc says , we need to update this in host settings. I have tried that but the timeout does not seem to be working. Can you confirm if it works for you in app settings?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.