Random (403) User Rate Limit Exceeded
Asked Answered
N

6

17

I am using translate API to translate some texts in my page, those texts are large html formated texts, so I had to develop a function that splits these texts into smaller pieces less than 4500 characters (including html tags) to avoid the limit of 5000 characters per request, also I had to modify the Google PHP API to allow send requests via POST.

I have enabled the paid version of the api in Goole Developers Console, and changed the total quota to 50M of characters per day and 500 requests/second/urser.

Now I am translating the whole database of texts with a script, it works fine but at some random points I revive the error "(403) User Rate Limit Exceeded", and I have to wait some minutes to re-run the script because when reached the error the api is returning the same error over and over until I wait some time.

I don't know why it keeps returning the error if I don't pass the number of requests, it's like it has some kind of maximum chaaracters per each interval of time or something...

Nereen answered 22/2, 2015 at 18:52 Comment(1)
"limit on request characters per second" - cloud.google.com/translate/v2/faq#technicalFrancefrancene
T
13

You probably exceed the quota limits you set before: this is either the daily billable or the limit on the request characters per second.

To change the usage limits or request an increase to your quota, do the following: 1. Go to the Google Developers Console "https://console.developers.google.com/". 2. Select a project. 3. On the left sidebar, expand APIs & auth. 4. Click APIs. 5. Click the name of an activated API you're interested in "i.e. The Translate API". 6. Near the top of the info page for the API, click Quota.

  • If you have the billing enabled, just click Quota and it will take you to the quota page where you can view and change the quota-related settings.

  • If not, clicking Quota shows information about any free quota and limits that apply to the Translate API.

Treasure answered 1/4, 2015 at 4:3 Comment(4)
This worked great, every where else I Googled didn't have an answerVenice
@mohab unfortunately this is not true. I get this same error once in a while even though the number of requests are less than 1% of the quota. the main reason is that Google APIs are crapy. I have been using almost all Google APIs since 2012, different versions and version after version they get crappier and crappier.Bathilda
This may have something to do with a particular Google App domain. Believe there is a 10 requests per second limit per user. Google API is garbage because it just doesn't work as it should work. Our more active users are having this issue, pretty much makes the whole integration uselessBathilda
I need help with something related to quota exceeded: #45325247Recor
B
2

Google Developer Console has a rate limit of 10 requests per second, regardless of the settings or limits you may have changed.

You may be exceeding this limit.

I was unable to find any documentation around this, but could verify it myself with various API requests.

Bendicty answered 31/1, 2018 at 3:23 Comment(0)
M
1

You control the characters limitation but not the concurrency

You are either making more than 500 concurrent request/second or you are using another Google API that is hitting such concurrency limitation.

Mossback answered 18/3, 2015 at 12:15 Comment(1)
Unfortunately this is not the reason. These are random errors with wrong messages. There are no solutions for these unless Google fixes its own code.Bathilda
K
1

The referer header is not set by default, but it is possible to add the headers to a request like so:

$result = $t->translate('Hola Mundo', [
    'restOptions' => [
        'headers' => [
            'referer' => 'https://your-uri.com'
        ]
    ]
]);

If it makes more sense for you to set the referer at the client level (so all requests flowing through the client receive the header), this is possible as well:

$client = new TranslateClient([
    'key' => 'my-api-key',
    'restOptions' => [
        'headers' => [
            'referer' => 'https://your-uri.com'
        ]
    ]
]);

This worked for me!

Reference

Kakapo answered 7/1, 2019 at 13:38 Comment(0)
D
1

In my case, this error was caused by my invalid payment information. Go to Billing area and make sure everything is ok.

Decile answered 5/10, 2021 at 13:45 Comment(1)
Thank you, yes due to Rs 0.33 overdue, I got this error, after successful payment done, then its working greatMandal
I
0

After hours of wondering around in Google Cloud settings, I found that is was the invalid payment information, as Federico Schiocchet mentioned, make sure your billing information is correct.

Imagine answered 2/3, 2023 at 4:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.