1
votes

I get this error when I try to use Google Speech from either the cmd command line (Windows 10) using curl or from a local Firebase server.

"Cloud Speech API has not been used in project firebase-cli before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/speech.googleapis.com/overview?project=firebase-cli then retry"

Going to the suggested URL just gives the message:

The API "speech.googleapis.com" doesn't exist or you don't have permission to access it

The curl command has worked before. Login seems to work (using Bearer header). I have no idea why it does not work now. Did I do something before that made it work? Or is there some change to Firebase CLI/Google Speech?

EDIT: Here is the curl command that worked before. I do not think it matters here, but someone might be interested still:

@for /f %%i in ('gcloud auth application-default print-access-token') do @set bearer=%%i

curl -X POST ^
 -H "Authorization: Bearer %bearer%" ^
 -H "Content-Type: application/json; charset=utf-8" ^
 --data @request-flac.json ^
 "https://speech.googleapis.com/v1/speech:longrunningrecognize"
1
It's going to be hard to help without seeing the code/CLI command/curl call that you run.Frank van Puffelen
@FrankvanPuffelen I don't think it matters since it worked before, but I have added it. Maybe I am wrong.Leo
You sure that the gcloud auth step completed successfully? Does the script work from the cloud shell?Oliver
@Oliver The auth step seems to work. I can see the bearer. The error message is the same as above. (I will try the cloud shell later.)Leo

1 Answers

1
votes

Follow the Cloud Speech API quickstart. There is a button that will help you enable the API in your project. If you don't want to do it that way:

  1. Go to the GCP console
  2. Select the APIs and Services option in the left menu
  3. Select dashboard
  4. Click Enable APIs and Services
  5. Type "speech" in the search box
  6. Click the "Speech API" card
  7. Click Enable

This is the generalized way to enable APIs in your project.