nodejs-speech
nodejs-speech copied to clipboard
Error: 14 UNAVAILABLE: 408:Request Timeout
Error: 14 UNAVAILABLE: 408:Request Timeout at Object.callErrorFromStatus (/Users/gomda/Desktop/TOIA-2.0/server/node_modules/@grpc/grpc-js/build/src/call.js:31:26) at Object.onReceiveStatus (/Users/gomda/Desktop/TOIA-2.0/server/node_modules/@grpc/grpc-js/build/src/client.js:391:49) at Object.onReceiveStatus (/Users/gomda/Desktop/TOIA-2.0/server/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:299:181) at /Users/gomda/Desktop/TOIA-2.0/server/node_modules/@grpc/grpc-js/build/src/call-stream.js:160:78 at processTicksAndRejections (internal/process/task_queues.js:77:11) { code: 14, details: '408:Request Timeout', metadata: Metadata { internalRepr: Map(4) { 'content-type' => [Array], 'content-length' => [Array], 'date' => [Array], 'alt-svc' => [Array] }, options: {} } }
I am getting the following error with the google speech to text library. I was directed to this bug report page to help me fix it.
Any help would greatly be appreciated.
Can you provide short sample code here that reproduces the issue?
This is the part of the code that produces the error @kweinmeister:
async function createStream(req, res){
recognizeStream = await client
.streamingRecognize(speech_to_text.request)
.on('error', err =>{
console.log("error code: ", err.code)
console.log(err)
FinishTrancription();
restartStream();
})
.on('data', async (data) =>{
if(!streamStarted) return;
//speechCallback(data);
process.stdout.write(
data.results[0] && data.results[0].alternatives[0]
? Transcription: ${data.results[0].alternatives[0].transcript}\n
: '\n\nReached transcription time limit, press Ctrl+C\n'
)
await responseChunks.push(${data.results[0].alternatives[0].transcript});
if(req.body.params && req.body.params.fromRecorder === false){
let response = "";
let noSpaces = [];
//console.log(responseChunks)
responseChunks.forEach(elem => noSpaces.push(elem.trim()))
let uniqueChars = [...new Set(noSpaces)];
//console.log("set elements: ", uniqueChars);
await uniqueChars.forEach(elem => response += (elem + " ")); //res.write(elem));
res.send(response);
console.log("response sent: ", response);
FinishTrancription();
return;
}
}
);
timeout = setTimeout(restartStream, streamingLimit);
}
Hi All,
We are experiencing this error a few times a day on our platform. We put a lot of volume through speech to text so if you need any help debugging this we would be more than happy to help. This does not happen to every call and is very intermittent.
Thanks, Joe
@icabbi-joegarlick @kweinmeister I found a workaround, but the only issue I am facing now is that the data is an Int 16 bit buffer array from the client, but when that data is written to the recognizeStream, no data and no error is thrown. Should the array be converted to another format?
@asgomda out of curiosity, what workaround did you end up implementing?
This error is starting to appear more often in the last 2 days. Additionally we are also getting:
14 UNAVAILABLE: No connection established
@asgomda could I bother you to open a new issue, with the question regarding 16 bit buffers -- since this is not related to 408 timeouts.
@jcbjoe @jcbjoe could you provide the following:
- a gist of the code you are using to interact with the speech API.
- information about the environment you're running in (are you in Cloud Run, Cloud Functions, running on laptop).
Hi @bcoe,
I have spoke to support about these errors and they said they were within SLA and we are only getting around 0.3% of requests. I assume these errors are actually from the Google side of things. They advised us to implement a retry strategy so that if a request fails we try again. So far this seems to be working for us.
- Is there anyway I can send you this privately?
- We run on the AWS EC2 platform. They are inside of a public subnet and the servers have full access outbound.
Thanks, Joe
@jcbjoe please feel free to send an email to bencoe [at] google.com. If the errors are within SLA, I can't promise I can do much. But I am, at least, interested in seeing if we could add features to make errors easier to debug. We should be retrying UNAVAILABLE for 60s on our end, it would be nice to have debug logs to confirm that this retry is actually happening for you.
@bcoe I will send you an email over now. More than happy to enable extra debug logs. I saw there was some retry options as part of the SpeechClient but I wasn't 100% sure on how to implement it.
I have also got 2 full error messages from failed requests
{
"code": 14,
"details": "408:Request Timeout",
"metadata": {
"content-type": [
"application/grpc"
],
"content-length": [
"0"
],
"date": [
"Fri, 04 Mar 2022 16:03:02 GMT"
],
"alt-svc": [
"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""
]
}
}
{
"code": 14,
"details": "408:Request Timeout",
"metadata": {
"content-type": [
"application/grpc"
],
"content-length": [
"0"
],
"date": [
"Fri, 04 Mar 2022 17:10:56 GMT"
],
"alt-svc": [
"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""
]
}
}
I think this was resolved over email based on the comments above, but if you are still seeing this, please open a new issue!