1

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 :

  • has Google changed it's quota limitation? (I didn't see any communication about it)
  • Is there a way to see how many calls was made for each service?
  • Is there a sort of chat for technical support for Google Apps Script?
Rubén
  • 34,714
  • 9
  • 70
  • 166
  • What you need to realize is that the limit of 20,000 per day is actually 20,000/(24*60*60) which is about 0.23 calls per second and if you exceed that rate you will run the risk of getting those errors. It’s the only fair way to perform those restrictions in server with many users. – Cooper Dec 29 '20 at 18:28

1 Answers1

3

Answer(s):

  • has Google changed it's quota limitation? (I didn't see any communication about it)

No.

  • Is there a way to see how many calls was made for each service?

No.

  • Is there a sort of chat for technical support for Google Apps Script?

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:

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Rafa Guillermo
  • 14,474
  • 3
  • 18
  • 54
  • 1
    I believe your result is in seconds per call not calls per second that would be 20000/(24*60*60) – Cooper Dec 29 '20 at 18:32
  • @Cooper You’re right, thank you, I’ve edited the calculation – Rafa Guillermo Dec 29 '20 at 18:39
  • Do you have an example as to how one might use exponential backoff in this example? It seems to me that when you pass the magic threshold that google says stop. You get an error and that's the end of your function until they decide to turn in back on. I've always tried to stay a good margin away from the minimum to avoid any problems. – Cooper Dec 29 '20 at 19:01
  • Thanks for the explanation, but i doubt we was hitting the 0.231 call/sec as the function is called when we click on a button (and it happens maybe 1 time every 10-15min). And we are only 3 person to use the spreadsheet. I think it was a temporary bug as it worked with no problem later on the day. (Google make some updates now for their different services, maybe it's the cause) – RAKOTOMALALA Franco Dec 30 '20 at 12:47