Warm tip: This article is reproduced from serverfault.com, please click

Azure Python Function Retry Limitting not Working in Logic Apps

发布于 2020-12-01 18:26:37

I've tried two methods to limit the retries of a "failed" function and neither have worked (described below). I'm developmentally challenged, so any and all help would be appreciated.

The context: the function is placed in a logic app, which is triggered by an email, after the email attachment is saved to blob. After the file is saved, the function performs successfully but the logic app returns "BadRequest. Http request failed: the server did not respond within the timeout limit" after a run-time of 2-3 minutes. Then the logic app retries the function 4 additional times.

Method 1: I placed retry into the host.json:

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[1.*, 2.0.0)"
  },
  "retry": {
    "strategy": "fixedDelay",
    "maxRetryCount": 0,
    "delayInterval": "00:00:05"
  }
}

Methods 2: I placed the same snippet into the function.json:

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "authLevel": "anonymous",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "methods": [
        "get",
        "post"
      ]
    },
    {
      "type": "http",
      "direction": "out",
      "name": "$return"
    }
  ],
  "retry": {
    "strategy": "fixedDelay",
    "maxRetryCount": 0,
    "delayInterval": "00:00:10"
}
}
Questioner
Joseph Kozsuch
Viewed
0
Frank Gong 2020-12-02 15:28:12

The retry policy is defined by azure logic app, you should not configure it in functions, but configure a retry policy in azure logic app actions. You can refer to Retry policies:

For the most basic exception and error handling, you can use a retry policy in any action or trigger where supported, for example, see HTTP action. A retry policy specifies whether and how the action or trigger retries a request when the original request times out or fails, which is any request that results in a 408, 429, or 5xx response. If no other retry policy is used, the default policy is used.

If you want to configure the number of retries to 0, please follow the steps below.

You can click ··· in the upper right corner of the Http action, then click Settings, and select None under Retry Policy

enter image description here