Azure Function Proxy - Cold Startup - Error 429 Too many requests

Viewed 2378

I've set up a function app in Azure. I've added a proxy to the function (so I can assign it a different URI).

When the proxy and function have been torn down and its time to wake it up, I sometimes get the error code 429: Too many requests from a single Postman/insomnia request to wake it up.

How do I stop this from happening?

For the time being, I've added a logic app to ping it every 5 mins.

5 Answers

Seems to be something with the last release of https://github.com/Azure/azure-functions-host/releases/tag/v3.0.15185 On the date of this release we started receiving 429s, a lot, on the functions we had running for a long time.

We fixed it by adding the following to the hosts.json:

  "extensions": {
    "http": {
      "dynamicThrottlesEnabled": false
    }
  }

Doc: https://docs.microsoft.com/pt-br/azure/azure-functions/functions-bindings-http-webhook-output

My guess is that they've changed some default values.

EDIT: We are operating for a long time using BOTH, the hosts.json update from above and the pinned version, stated by sanjo (https://stackoverflow.com/a/65311645/10585914).

You can follow the entire discussion here: https://github.com/Azure/azure-functions-host/issues/6984

And the PR: https://github.com/Azure/azure-functions-host/pull/6986

We are also experiencing 429's in our and has been advised by MS to force the Azure Functions Extensions to a lower version by setting FUNCTIONS_EXTENSION_VERSION to 3.0.14916.0 instead of ~3

We're still evaluating the "solution".

From Microsoft support, there are 2 workarounds:

  • Cassio's answer, which actually worked for us for a couple hours but then stopped working. We had been getting very consistent 429s for multiple days, then a brief stoppage after the change, then it came back.
  • Update your FUNCTIONS_EXTENSION_VERSION app setting to the previous version (3.0.14916.0). This has worked again in the short time since we've changed it.

App Setting Update

I don't think your 5 minute ping is a problem like the answer from Hury Shen. We have recently begun receiving 429 requests anytime our functions wake from a cold period. I don't know what has changed at Azure side but it is not good! One fix you could try is simply redeploy your function, we did this and it worked at least for a time! Will report back if we find anything else

It seems the error was caused by the logic app ping the function every 5 mins. Per my understanding, you schedule the logic app request function to keep the function awake.

If so, you do not need to create the logic specifically to wake it up. You can choose Premium plan for your function app when you create it. enter image description here

And then go to "Scale out" tab of your function app, you can set Always Ready Instances as 1. Then your function will have one instance always awake, function will not cold start when a request come. enter image description here

As Premium plan plan provides the same features and scaling mechanism used on the Consumption plan (based on number of events) with no cold start, so it will cost much more than Consumption plan. You can refer to this page about function cost. enter image description here

Related