首页 > 解决方案 > 如何解决 Google Speech-To-Text Error 的错误?

问题描述

我已经设置了 package.json 文件。

"scripts": {
    "start": "set GOOGLE_APPLICATION_CREDENTIALS=/My Path/my.json && node app.js"
},

但是,我有这样的错误,

(node:28590) UnhandledPromiseRejectionWarning: Error: 7 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 speech.googleapis.com. We recommend configuring the billing/quota_project setting in gcloud or using a service account through the auth/impersonate_service_account setting. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/. If you are getting this error with curl or similar tools, you may need to specify 'X-Goog-User-Project' HTTP header for quota and billing purposes. For more information regarding 'X-Goog-User-Project' header, please check https://cloud.google.com/apis/docs/system-parameters.
at Object.callErrorFromStatus (/Users/bruce/Workspace/amosense/node_modules/@grpc/grpc-js/build/src/call.js:31:26)
at Object.onReceiveStatus (/Users/bruce/Workspace/amosense/node_modules/@grpc/grpc-js/build/src/client.js:179:52)
at Object.onReceiveStatus (/Users/bruce/Workspace/amosense/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:336:141)
at Object.onReceiveStatus (/Users/bruce/Workspace/amosense/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:299:181)
at /Users/bruce/Workspace/amosense/node_modules/@grpc/grpc-js/build/src/call-stream.js:145:78
at processTicksAndRejections (internal/process/task_queues.js:77:11)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:28590) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:28590) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

我已经尝试按照以下指南进行操作,但仍然遇到与上述相同的错误。 类似问题

奇怪的是,它在服务器上运行良好,但在 localhost 上不断出现错误。我希望有人可以指导我。

谢谢。

标签: node.jsgcloud

解决方案


推荐阅读