dialogflow-nodejs-client-v2 without GOOGLE_APPLICATION_CREDENTIALS environement variablesessionClient.detectIntent(request)Error: Dialogflow 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/dialogflow.googleapis.com/overview?project=firebase-cli then retry.
If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
at /home/me/projects/dialogflow-cmd/node_modules/grpc/src/client.js:564:15
foobar-123.jsonexport GOOGLE_APPLICATION_CREDENTIALS="/home/me/secure/foobar-123.json"
IMHO the error is not clear at all. The two help explanations in the error ("Dialogflow API has not been used in project firebase-cli before or it is disabled.") are false and looking for the string "firebase-cli" on my project files was a dead end.
Something like "Environement variable GOOGLE_APPLICATION_CREDENTIALS not detected or empty, it is needed to authenticate throught service, please follow explantions here https://cloud.google.com/docs/authentication/getting-started"
I still dont understand where the "firebase-cli" string come from...
Also, this bug has been reported on these :
https://stackoverflow.com/questions/47941896/failure-calling-dialogflow-api-by-using-npm-programm
https://stackoverflow.com/questions/48145572/connecting-with-dialogflow-v2-api-using-python
https://productforums.google.com/forum/#!topic/dialogflow/akANtXsILKg
I notice all the API call examples have "// optional auth parameters" in their options object, so I believe there is more than one way to get authentication in place. i.e. GOOGLE_APPLICATION_CREDENTIALS in environment isn't the only way so not sure the error should only say that.
But otherwise, yes the message is pretty unclear if it is talking about random project names!
the gcloud tool seems to be an alternative option to set up auth, but it's still a auth related error right ?
Oh yeah - Not denying it's an auth thing. Just questioning whether the error message is the right place to describe a (raft of?) different authenticating mechanisms.
P.S. Are you sure you've never had a project called firebase-cli? Try "firebase logout" and see what changes? "firebase login" and "firebase use" store state in some magical location that has caused me similar drama in the past...
yup this name was pretty curious to me, never created a project called firebase-cli, like if I was mad enough to create a command line tool for something I just discovered few days ago :stuck_out_tongue_closed_eyes:
also I looked everywhere (with a recursive find/grep) in the source files and also in node_modules, I also did a search in my /home directory to find some config files related to google/firebase things, nothing... on my google console where all my projects are listed nothing, also on firebase console...
BTW - I've confirmed in my project just released here: https://www.npmjs.com/package/voice-assistants-cli
That you can also 'point to' that same credential file via the property keyFilename in the options object passed into all API calls. (Without setting env.GOOGLE_APPLICATION_CREDENTIALS)
This is some Google API standard it seems.
With your "firebase-cli" mystery... Have you tried "firebase logout/login" in your shell? I looked EVERYWHERE (like you) for something like this with firebase CLI before and never found it... Binary? Encrypted? Magic storage? who knows... Eventually I had to re-run "firebase use" to fix my mysterious problem.
I wonder if the Devs ever pass by these parts...
The error is coming from the grpc module
node_modules/dialogflow/node_modules/grpc/src/client.js:554:15
This client lib could catch the error, check the code (7), and throw a more suitable error message.
Here's the error dump, in case it's helpful.
{ Error: Dialogflow 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/dialogflow.googleapis.com/overview?project=firebase-cli then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
at /Users/username/workspace/project/functions/node_modules/dialogflow/node_modules/grpc/src/client.js:554:15
code: 7,
metadata:
Metadata {
_internal_repr:
{ 'google.rpc.help-bin': [Object],
'grpc-status-details-bin': [Object],
'grpc-server-stats-bin': [Object] } } }
Steps for setting up credentials are described in the doc for setting up the local firebase function emulator. Maybe we can point there?
Is this still true today?
If my GOOGLE_APPLICATION_CREDENTIALS are empty,
I get:
com.google.api.gax.rpc.PermissionDeniedException:
io.grpc.StatusRuntimeException: PERMISSION_DENIED:
Your application has authenticated using end user credentials from the Google Cloud SDK
or Google Cloud Shell which are not supported by the dialogflow.googleapis.com. We
recommend that most server applications use service accounts instead.
For more information about service accounts and how to use them in your application, see
https://cloud.google.com/docs/authentication/.
Let me know if this isn't true and I'll investigate further. Closing for now. :)
Isn't the error message terrible? ;-)
I just got this message and if I did not find this (closed) issue I think I would have been stuck for a while, sending a bug report etc. Thinking that this does not work yet.
BTW, using the URL that is mentioned in the error message just gives another error. And the API is enabled in the project.
Please provide a better error message.
ERROR: { Error: 7 PERMISSION_DENIED: Cloud Speech-to-Text API has not been used in project nnnnnnn before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/speech.googleapis.com/overview?project=nnnnnnnn then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
Hi, thanks for noting this. I've filed some bugs to help get these 2 issues improved.
1) Better error message to note when credentials aren't provided
2) Fix the error link provided to enable the API (if it hasn't been done yet)
Thanks @nnegrey , but would it not be much better to just fix the problem? The emulator should of course get the relevant data from the cloud. It just seems that the data for the used API:s is not yet fetched by the emulator.
A lot of people would be thankful if this was fixed.
I'm afraid, we can't create credentials on your behalf.
Most helpful comment
Steps for setting up credentials are described in the doc for setting up the local firebase function emulator. Maybe we can point there?
https://firebase.google.com/docs/functions/local-emulator