Issue with Policy Fragments and Retry in Backend

Sun Tongxin3 20 Reputation points
2025-02-05T07:13:28.8466667+00:00

We have added a wait policy to the policy fragment and introduced this fragment into the retry policy within the backend. The changes can be saved successfully, but an error occurs during execution, stating that the method cannot be found.User's image

User's image

User's image

Further testing has reproduced the issue. When we modified the conditions to trigger an exception, we found that the backend only allows one policy. By removing the retry and forward-request policies and retaining only the fragment reference, the system runs successfully without errors.

User's image

Therefore, we suspect that the issue only occurs when combining the backend with retry, include-fragment, and wait policies.

Can anyone assist in troubleshooting this issue? This situation is not mentioned in the documentation. Is it consistent with the product design?

https://docs.azure.cn/en-us/api-management/wait-policy

https://docs.azure.cn/en-us/api-management/include-fragment-policy

https://docs.azure.cn/en-us/api-management/retry-policy

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,303 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Khadeer Ali 3,670 Reputation points Microsoft Vendor
    2025-02-06T15:05:00.9833333+00:00

    @Sun Tongxin3 ,

    Welcome to Microsoft Q&A Platform!

    Thanks for reaching out. It seems that you're encountering an issue with combining the retry, include-fragment, and wait policies in the backend of your API Management configuration. Based on the context provided, policy fragments cannot include a policy section identifier or nest another policy fragment. This could potentially lead to conflicts when trying to execute multiple policies together, especially if one of them is a retry policy which expects certain conditions to be met.

    The error message stating that the method cannot be found may indicate that the execution flow is not able to resolve the combination of policies as intended. Since you've observed that removing the retry and forward-request policies allows the system to run successfully, it suggests that there may be limitations or specific requirements in how these policies interact when used in conjunction with fragments.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.