Reputation: 805
Hello I am trying not to use json approach and to use credential option to initiate the gcloud speech client.
const speech = require('@google-cloud/speech');
const client = new speech.SpeechClient({credentials:{private_key : "", client_email: ""}}});
but this is giving me Error: 3 INVALID_ARGUMENT: Request contains an invalid argument error.
I have used dialog flow and other services in the same fashion and that is working fine, please advise if I am missing something here.
Upvotes: 0
Views: 271
Reputation: 8074
Can you try:
const speech = require('@google-cloud/speech');
const config = { projectId: 'your-project', keyFilename:'key.json'};
const client = new speech.SpeechClient(config);
In your code you have an extra }, this worked for me.
const client = new speech.SpeechClient({credentials:{private_key : private_key, client_email: client_email}});
Upvotes: 1