【发布时间】:2020-10-06 11:39:39
【问题描述】:
我遵循官方文档 Google Cloud Speech-to-Text API 中的指南,但我不断收到错误消息:
starting-account-.iam.gserviceaccount.com 没有 拥有 storage.objects.get 访问权限。
const client = new speech.SpeechClient();
const gcsUri = bucket uri;
const encoding = 'LINEAR16';
const sampleRateHertz = 16000;
const languageCode = 'en-US';
const config = {
encoding: encoding,
sampleRateHertz: sampleRateHertz,
languageCode: languageCode
};
const audio = {
uri: gcsUri
};
const request = {
config: config,
audio: audio
};
const [operation] = await client.longRunningRecognize(request);
// Get a Promise representation of the final result of the job
console.log('operation', operation);
const [response] = await operation.promise();
const transcription = response.results
.map(result => result.alternatives[0].transcript)
.join('\n');
console.log(`Transcription: ${transcription}`);
我应该怎么做才能获得访问权限?
【问题讨论】:
-
请阅读此How to Ask...无论如何,您有 gcloud 权限问题,这不是代码问题
标签: node.js google-cloud-storage google-speech-api