Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drive API sharingRateLimitExceeded error

We have an application that manages the sharing permission for Google Drive files and folders using the Drive API. When our application tries to update the sharing settings of certain files or folders we get a 'sharingRateLimitExceeded' error:

Caused by: com.google.api.server.spi.response.UnauthorizedException: 403 FORBIDDEN {   "code" : 403,   "errors" : [ {
    "domain" : "global",
    "message" : "Rate limit exceeded. User message: \"These item(s) could not be shared because a rate limit was exceeded: SupportMenuItem.class\"",
    "reason" : "sharingRateLimitExceeded"   } ],   "message" : "Rate limit exceeded. User message: \"These item(s) could not be shared because a rate limit was exceeded: FILENAME\"" }

We already configured the API call to not send emails and our service account impersonates different users when changing permissions to avoid exceeding rate limits.

How do we find out which sharing limit is being exceeded? And once we know which sharing limit is being exceeded, where can we find how high that sharing limit is? Is it a per minute sharing limit or a per day sharing limit? We need more information on the error so we can adjust our script so the sharing limits are not exceeded anymore. The information on the error in the documentation is to limited to be of any value to us.

like image 490
Erik van den Hoorn Avatar asked Oct 20 '17 07:10

Erik van den Hoorn


People also ask

How do I fix Google authorization error 403?

You can try to fix error 403 in Google Chrome by refreshing the page, double-checking the address, clearing the cache and cookies from your browser, confirming that you have authorization to view the page, contacting the web site directly, or returning to the page later.

How do I fix exceeded sharing quota in Google Drive?

To get rid of the Google Drive quota exceeded error on that file, you need to transfer it from that account to yours. Once that file is moved to your own Google Drive account, it can be downloaded as usual. We will only copy the original file that does not trigger the download limit warning.

How do I fix Error 404 on Google Drive?

403 or 404 Errors Users of Google Drive can sometimes see Error 403 (permission denied) or Error 404 (not found). There are a few common reasons for this: You may have inadvertently deleted the Google worksheet. You can recover the deleted Google worksheet as described in Recover a deleted Google file or worksheet.


1 Answers

{   "code" : 403,   "errors" : [ {
        "domain" : "global",
        "message" : "Rate limit exceeded. User message: \"These item(s) could not be shared because a rate limit was exceeded: SupportMenuItem.class\"",
        "reason" : "sharingRateLimitExceeded"   } ],   "message" : "Rate limit exceeded. User message: \"These item(s) could not be shared because a rate limit was exceeded: FILENAME\"" } 

There is a limit to how many permissions you can insert in a day. That being around 50 in a 24 hour period of time you appear to have hit that quota. It should reset at mid night west cost usa time.

To my knowledge there is no way to extend this quota.

Documentation Handeling API errors

403: Sharing Rate Limit Exceeded

The user has reached a sharing limit. This is often linked with an email limit.

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "message": "Rate limit exceeded. User message: \"These item(s) could not be shared because a rate limit was exceeded: filename",
    "reason": "sharingRateLimitExceeded",
   }
  ],
  "code": 403,
  "message": "Rate Limit Exceeded"
 }
}

Suggested actions:

Do not send emails when sharing lot of files. If one user is making a lot of requests on behalf of many users of a G Suite domain, consider a Service Account with authority delegation to impersonate the owner of each document to share (setting the quotaUser parameter).

like image 70
DaImTo Avatar answered Sep 28 '22 05:09

DaImTo