google-apps-scripturlfetchquota

Service invoked too many times for one day: urlfetch - Pretty sure quota not exceeded


we use a custom script to retrieve data from Bookeo API with UrlFetchApp.fetch. µ Everything went well but today, we have the following error "Service invoked too many times for one day: urlfetch"

We are aware of the limitation of 20.000 calls/day as mentionned here https://developers.google.com/apps-script/guides/services/quotas, but we don't think that we come close to this (maybe 1.000 - 1.500/day max)

The portion of the code where the error happen is

var responseBooking = UrlFetchApp.fetch(urlBooking);

So i'm sure it's related to quota issue

The weird thing is it's working like 1 time / 5-6 try

My questions are :


Solution

  • Answer(s):

    No.

    No.

    No.

    More Information:

    Aside from the 20,000 calls/day limit, there are also limits which restrict the number of calls in short periods of time.

    The quota works based on a rolling average of service invocations. You have a quota of 20,000 per day, but if you exceed the rate of ~0.231 calls per second (20,000/86,400) for a sustained period of time, you can still trigger an error.

    You can rectify this by waiting for a while so that the impulse of invocations goes down. I would also suggest adding some form of exponential backoff to your code to stop this from happening again in future.

    References: