"An action failed. No dependent actions succeeded."
Most of you working with Logic Apps are probably familiar with the “An action failed. No dependent actions succeeded” exception that might occur within a Logic App. Unfortunately, this message does not offer much insight into the actual error and what might have gone wrong.
This starts to become a bigger issue once your production environment grows and the administrators need more time to figure out what actually went wrong within the failed Logic Apps.
To improve on this situation we can use the result function in combination with scopes, to try and get as much information about the exception as possible.
Setting Up Scopes
First, we start by introducing scopes withing the Logic App. There are generally two main scopes:
The first scope contains the actual implementation; for example, a call to an HTTP endpoint. The second scope will handle the exceptions that might occur during the first scope. Think of this like a try-catch setup.
The exception handling scope is where we will place our functionality, to try and retrieve as much error information as possible.
The Result Function
To achieve this, we will use the result function (https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#result). As the documentation states, this function allows us to return the results from the specified action(s).
Using the result function to get the results from our scope, we can then filter out the action that failed and get its error message. This can then be used in a Terminate shape to make sure the Logic App terminates with the actual error message, instead of the generic “An action failed. No dependent actions succeeded” message.
The exception handler scope contains the following actions:
The code is as follows:
After implementing this setup in our Logic Apps, I noticed that after a while I was sometimes still getting the basic “An action failed. No dependent actions succeeded” error message. As it turns out, the @result expression only gives the result of all the actions on the “first-level”. Any nested actions are not listed. It just shows that, for example, the Condition shape failed, but not which step within the condition and with only the basic error message showing.
I solved this by changing the @result expression to include multiple results. For example, if we have a Logic App that contains a Condition within an Until within the main Scope, the @result would look like this: “@union(result(‘Condition’), result(‘Until’), result(‘Scope’)). This combines all nested results, and allows the filter to get the actual error message!
Note: the @result expression does not allow any kind of variable, so I had to use the @union to combine all results.
It is important to give your administrators as much valuable information if an exception occurs. The “An action failed. No dependent actions succeeded” message only shows that something went wrong, and not specifically what.
The result function combined with scopes allows us to retrieve the actual error message for a failed Logic App, and gives your administrators much more information to work with!
Thanks for reading,
Subscribe to our RSS feed