Reputation: 4042
I'm using the node.js module for interacting with google speech API.
eg.
const Speech = require('@google-cloud/speech');
I'm processing thousands of audio clip transcriptions, as you'd expect....
speech.recognize(filepath, requestOptions)
.then((results) => {
//...
}
MOST succeed. However, every so often, I just get this error:
Error: Internal server error, code=7. Try your request again.
at /home/ubuntu/video_captions/source/node_modules/grpc/src/node/src/client.js:434:17
What in the heck is code 7? I can't find it in documentation.
Update: I seem to have found grpc error codes, but the codes are specified by variable names and not the primitive numeric value: https://grpc.io/docs/guides/error.html#general-errors
Upvotes: 0
Views: 2001
Reputation: 49543
gRPC error code 7
indicates GRPC_STATUS_PERMISSION_DENIED
.
/** The caller does not have permission to execute the specified
operation. PERMISSION_DENIED must not be used for rejections
caused by exhausting some resource (use RESOURCE_EXHAUSTED
instead for those errors). PERMISSION_DENIED must not be
used if the caller can not be identified (use UNAUTHENTICATED
instead for those errors). */
GRPC_STATUS_PERMISSION_DENIED = 7,
The gRPC error codes are also documented similarly here.
The Cloud Speech API documents the different error codes and PERMISSION_DENIED
is documented as follows:
PERMISSION_DENIED
The caller does not have permission to execute the specified operation. PERMISSION_DENIED must not be used for rejections caused by exhausting some resource (use RESOURCE_EXHAUSTED instead for those errors). PERMISSION_DENIED must not be used if the caller can not be identified (use UNAUTHENTICATED instead for those errors). This error code does not imply the request is valid or the requested entity exists or satisfies other pre-conditions.
HTTP Mapping: 403 Forbidden
Also from your question, it is not clear what is the source of the audio content. If it is on Google Cloud Storage, you might want to ensure that you have the right permissions to access the content, which I feel could be a possible reason to see permission denied errors.
Also, when you get this error you could check what happens if you issue the same request once again - does it fail the same way or does it succeed? This will help to confirm if they are one-off errors or if they are related to your request headers and/or payload.
The speech API does have request limits which are also enforced, make sure you're not exceeding them and you might hit similar errors for those too. Although, for this case I think you will see a different error RESOURCE_EXHAUSTED
instead of PERMISSION_DENIED
. I'm adding this just as a FYI.
The current API usage limits for the Cloud Speech API are as follows (and are subject to change):
Type of Limit Usage Limit --------------------------------------------------- Requests per 100 seconds* 500 Requests per day* 250,000 Processing per 100 seconds 5000 seconds of audio Processing per day 480 hours of audio
- Each
StreamingRecognize
session is considered a single request even though it includes multiple frames of StreamingRecognizeRequest audio within the stream.Requests and/or attempts at audio processing in excess of these limits will produce an error.
These limits apply to each Cloud Speech API developer project, and are shared across all applications and IP addresses using a given a developer project.
Upvotes: 2