您好,我尝试不使用json方法,而是使用凭据选项来启动gcloud语音客户端。
const speech = require('@google-cloud/speech');
const client = new speech.SpeechClient({credentials:{private_key : "", client_email: ""}}});
但是这给了我错误:3 INVALID_ARGUMENT:请求包含无效的参数错误。
我以相同的方式使用了对话流和其他服务,并且运行良好,请告知我是否在这里缺少任何内容。
您可以尝试:
const speech = require('@google-cloud/speech');
const config = { projectId: 'your-project', keyFilename:'key.json'};
const client = new speech.SpeechClient(config);