谷歌语音自适应客户端(node.js)-未处理的PromiseRejection警告:错误:13内部:遇到内部错误



我正在尝试使用Google Speech API中的nodejsAdaptationClient创建CustomClass(此处为文档https://googleapis.dev/nodejs/speech/latest/v1p1beta1.AdaptationClient.html)

我在Elastic Beanstalk上运行,配置如下:Node.js 12 running on 64bit Amazon Linux 2/5.3.1

const speechToText = require('@google-cloud/speech').v1p1beta1;
const adaptationClient = new speechToText.AdaptationClient({
credentials: {client_email: client_email,
private_key: private_key},
projectId: project_id
});
const request = {
parent: 'v1p1beta1/projects/myproject/locations/global/customClasses',
customClassId: 'test-class',
customClass: {"items": [{value: "foo"}, {value: "bar"}]}
}
const [response] = await adaptationClient.createCustomClass(request)

结果:

web: (node:31369) UnhandledPromiseRejectionWarning: Error: 13 INTERNAL: Internal error encountered.
web: at Object.callErrorFromStatus (/var/app/current/node_modules/@grpc/grpc-js/build/src/call.js:31:26)
web: at Object.onReceiveStatus (/var/app/current/node_modules/@grpc/grpc-js/build/src/client.js:176:52)
web: at Object.onReceiveStatus (/var/app/current/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:336:141)
web: at Object.onReceiveStatus (/var/app/current/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:299:181)
web: at /var/app/current/node_modules/@grpc/grpc-js/build/src/call-stream.js:145:78
web: at processTicksAndRejections (internal/process/task_queues.js:79:11)

我确信我使用的服务帐户是有效的,因为我使用SpeechClient()进行的所有调用都能正常运行。

我们在nodejs中找到了一个用于模型自适应的GitHub代码示例,我对其进行了测试,它运行良好,没有任何错误

我建议您尝试通过将父源更改为"projects/myproject/locations/global"而不是"v1p1beta1/projects/myproject.locations/global/customClasses"来运行。此处"myproject"应为projectID

相关内容

最新更新