getEntries: Insufficient tokens for quota 'logging.googleapis.com/read_requests' and limit 'ReadRequestsPerMinutePerProject'
See original GitHub issueI am getting this error when ever I run the following code.
Error: Insufficient tokens for quota 'logging.googleapis.com/read_requests' and limit 'ReadRequestsPerMinutePerProject' of service 'logging.googleapis.com' for consumer 'project_number:1234567890123'.
Apparently, this is due to the “Read Requests” Quota which I see here: https://console.cloud.google.com/apis/api/logging.googleapis.com/quotas?project=PROJECT_ID&authuser=1&duration=PT1H
However, this is literally the only code that is contributing to this quota. As you can see in the image, there are 0 entries until I run this code, then it spikes to 60 per minute and I get the error above. I’m guessing there is something deeper in the getEntries
function that makes an additional call that contributes to the “Read Requests” quota, but I can’t tell what it might be. I may not be looking deep enough though.
Environment details
- OS: MacOS but also App Engine
- Node.js version: v8.5.0
- npm version: 5.6.0
- @google-cloud/logging version: 1.1.4
Steps to reproduce
- Copy this code into a file or the repl. Replace INSTANCE_NAME, or not. The error occurs regardless of a good instance name.
const Logging = require( '@google-cloud/logging' );
const logging = new Logging();
var theLogFilter = 'jsonPayload.resource.name=INSTANCE_NAME';
var metadata;
logging.getEntries({
filter: theLogFilter
}, (err, entries, nextQuery, apiResponse) => {
if( err ) {
console.log( "ERROR: " + err );
return;
}
console.log( "RESULTS: " + JSON.stringify( entries ) );
});
This results in:
travisdepuy@appletree:~/the-badger$ node
>
>
> const Logging = require( '@google-cloud/logging' );
undefined
> const logging = new Logging();
undefined
>
>
> var theLogFilter = 'jsonPayload.resource.name=INSTANCE_NAME';
undefined
>
> var metadata;
undefined
>
> logging.getEntries({
... filter: theLogFilter
... }, (err, entries, nextQuery, apiResponse) => {
...
... if( err ) {
... console.log( "ERROR: " + err );
... return;
... }
...
... console.log( "RESULTS: " + JSON.stringify( entries ) );
... });
undefined
>
>
>
>
>
> ERROR: Error: Insufficient tokens for quota 'logging.googleapis.com/read_requests' and limit 'ReadRequestsPerMinutePerProject' of service 'logging.googleapis.com' for consumer 'project_number:1234567890123'.
>
I’ve tried waiting a couple of days and it still seems to happen. Does this happen for anyone else?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Indeed, it seems like
getEntries
will surpass the limit withautoPaginate: true
. I’ll open a new issue for this.There’s only one change you need to not blow the quota, and that’s:
By default,
autoPaginate
is set to true. When the API responds with a cursoring token, that indicates to us that there may be more results, so we runnextQuery
automatically. Interestingly, this returns a cursoring token endlessly, which is why it runs until the quota limit is met.