hyone
hyone

Reputation: 105

Quota exceeded for quota metric 'speech.googleapis.com/default_requests' not really understandable

I'm currently playing with a GCP service called API Speech-to-Text, using the NodeJS client library. For that, I followed the quickstart documentation, trying to recognize a short local audio file (quite simply) first. However, I keep getting this error when I run node test_sample.js :

ERROR: { Error: Quota exceeded for quota metric 'speech.googleapis.com/default_requests' and limit 'DefaultRequestsPerMinutePerProject' of service 'speech.googleapis.com' for consumer 'project_number:764086051850'.
    at Http2CallStream.call.on (/Users/macOSuser/Projects/nodejs-speech/samples/node_modules/@grpc/grpc-js/build/src/client.js:102:45)
    at Http2CallStream.emit (events.js:198:15)
    at Http2CallStream.endCall (/Users/macOSuser/Projects/nodejs-speech/samples/node_modules/@grpc/grpc-js/build/src/call-stream.js:74:18)
    at /Users/macOSuser/Projects/nodejs-speech/samples/node_modules/@grpc/grpc-js/build/src/call-stream.js:163:18
    at processTicksAndRejections (internal/process/task_queues.js:86:5)

Note : the mentioned project_number is not the same as mine

I have already tried to change my default gcloud project/account, as well as creating a brand new project and activating the API again. I also checked on the GCP Console how were my request graphs, and yes they are empty

The sample code for quickstart can be found here

Thank you for your help on that

Edit solved : This was an authentification issue, which I solved using a service account's JSON key and refering by running export GOOGLE_APPLICATION_CREDENTIALS="/PATH-TO-FILE/key.json". Thanks @JJ Geewax

Upvotes: 4

Views: 2899

Answers (1)

JJ Geewax
JJ Geewax

Reputation: 10579

You noted that the project number isn't the same as the one you're seeing the error result, so that seems to be the bigger problem here... The Google Cloud client libraries get the project information and credentials from a few different places (with different priorities for each), so it's possible that you're accidentally picking up credentials and identity from the application defaults (possible the gcloud command-line tool). Can you update the question with the code you're running to get this error?

There are a few ways to fix an issue like this, but the easiest is probably to just run: gcloud auth application-default login in the command line (documentation).

Once you follow the authentication flow, you should end up with credentials for the intended project.

You also might want to take a look at the Getting Started with Authentication guide for GCP in Node.js which talks about creating a service account and setting those credentials using an environment variable.

Upvotes: 2

Related Questions