question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getEntries: Insufficient tokens for quota 'logging.googleapis.com/read_requests' and limit 'ReadRequestsPerMinutePerProject'

See original GitHub issue

I 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

image

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

  1. 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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
stephenpluspluscommented, Mar 14, 2018

Indeed, it seems like getEntries will surpass the limit with autoPaginate: true. I’ll open a new issue for this.

1reaction
stephenpluspluscommented, Mar 14, 2018

There’s only one change you need to not blow the quota, and that’s:

logging.getEntries({
+   autoPaginate: false,
    filter: theLogFilter
}, (err, entries, nextQuery, apiResponse) => {

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 run nextQuery automatically. Interestingly, this returns a cursoring token endlessly, which is why it runs until the quota limit is met.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Insufficient tokens for quota 'administrator' and limit ...
You are running up against the quota for administrative operations. In the Quotas page, under "Quota type," select "All quotas," then under ...
Read more >
Quotas and limits - Logging - Google Cloud
To view your quotas, go to the API dashboard. Click an API and select Quotas. Lifetime of API page tokens, 24 hours. Number...
Read more >
1 Answer - 1 - Server Fault
Probably you are hitting the 20 QPS max requests quota. Try checking how many read/write requests you've been doing. It's unlikely this will ......
Read more >
Limits and Quotas on API Requests | Analytics Management API
For Reporting API v4, the API name in Google API Console is Google Analytics Reporting API. All other v3 APIs (e.g., Management API...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found