I have been trying to use Google Speech-to-text v2 in node.js to recognize streaming input. For those who have worked on the same, they must know that this version requires us to create a ‘recognizer’ which depends on the location and model that we want to transcribe the language with. For a lot of languages, we have the global location. For some languages, global is not supported. Some examples are: bn-IN and yue-Hant-HK.
Let’s pick two languages, yue-Hant-HK and en-US:
- en-US has a global long recognizer. yue-Hant-HK has a us-central1 chirp recognizer.
Now, I created a speech client for the two languages as follows:
For en-US:
this.speechClient = new SpeechClient({
keyFilename: <path to service account file>
projectId: <project id>,
});
For yue-Hant-HK, I add a apiEndpoint: "us-central1-speech.googleapis.com"
, otherwise it doesn’t work.
Then I perform streaming recognition on the input audio. For en-US it works. But for yue-Hant-HK, I get the following error:
Error: 7 PERMISSION_DENIED: The caller does not have permission
at callErrorFromStatus (/Users/lovishchopra/Desktop/SDP/dp/node_modules/@grpc/grpc-js/src/call.ts:82:17)
at Object.onReceiveStatus (/Users/lovishchopra/Desktop/SDP/dp/node_modules/@grpc/grpc-js/src/client.ts:705:51)
at Object.onReceiveStatus (/Users/lovishchopra/Desktop/SDP/dp/node_modules/@grpc/grpc-js/src/client-interceptors.ts:419:48)
at /Users/lovishchopra/Desktop/SDP/dp/node_modules/@grpc/grpc-js/src/resolving-call.ts:163:24
at processTicksAndRejections (node:internal/process/task_queues:77:11)
for call at
at ServiceClientImpl.makeBidiStreamRequest (/Users/lovishchopra/Desktop/SDP/dp/node_modules/@grpc/grpc-js/src/client.ts:689:42)
at ServiceClientImpl.<anonymous> (/Users/lovishchopra/Desktop/SDP/dp/node_modules/@grpc/grpc-js/src/make-client.ts:189:15)
at /Users/lovishchopra/Desktop/SDP/dp/node_modules/@google-cloud/speech/build/src/v2/speech_client.js:329:29
at /Users/lovishchopra/Desktop/SDP/dp/node_modules/google-gax/build/src/streamingCalls/streamingApiCaller.js:46:28
at /Users/lovishchopra/Desktop/SDP/dp/node_modules/google-gax/build/src/normalCalls/timeout.js:44:16
at StreamProxy.setStream (/Users/lovishchopra/Desktop/SDP/dp/node_modules/google-gax/build/src/streamingCalls/streaming.js:407:24)
at StreamingApiCaller.call (/Users/lovishchopra/Desktop/SDP/dp/node_modules/google-gax/build/src/streamingCalls/streamingApiCaller.js:54:16)
at /Users/lovishchopra/Desktop/SDP/dp/node_modules/google-gax/build/src/createApiCall.js:108:30
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 7,
details: 'The caller does not have permission',
metadata: Metadata { internalRepr: Map(0) {}, options: {} }
}
Can someone help with the same?
I even went ahead and gave the service account file owner permissions but still gives the same error.
Lovish Chopra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.