-
Notifications
You must be signed in to change notification settings - Fork 653
@google-cloud/speech Operation not returning. #2408
Copy link
Copy link
Closed
Labels
api: speechIssues related to the Speech-to-Text API.Issues related to the Speech-to-Text API.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
Description
Environment details
- OS: google-cloud-functions
- Node.js version: ?
- npm version: ?
- google-cloud-node version: ?
Steps to reproduce
I'm trying to use the node.js speech api client to return text using google cloud functions. I have the following in my index.js:
// Get a reference to the Cloud Vision API component
const speech = require('@google-cloud/speech')();
/**
* Background Cloud Function to be triggered by Cloud Storage.
*
* @param {object} event The Cloud Functions event.
* @param {function} The callback function.
*/
exports.audio2text = function (event, callback) {
const file = event.data;
console.log(`uploaded file ${file.name}, beginning transcription...`)
var config = {
encoding: 'FLAC',
languageCode: 'en-US',
sampleRateHertz: 48000,
verbose: true
};
speech.startRecognition(`gs://influx-audio-upload/${file.name}`, config)
.then(function(data) {
console.log("apiResponse: ", data[1])
console.log("Operation started")
data[0].on("error", (err) => {
console.log("Operation err")
console.log(err)
}).on("complete", (results) => {
console.log("Operation complete")
results.forEach((element) =>{
console.log(element.transcript)
})
})
}).catch(err => {
console.log("in error")
console.log(err)
})
console.log("end of function")
callback();
};
Uploading and transcribing shorter audio (~5m) works just fine, however when I try longer audio (~30m) the Operation never returns. I've tried defining the cloud function with a longer timeout (--timeout 9m) and I'm still not getting any returns. Am I on the right track or is this API not intended to function this way?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: speechIssues related to the Speech-to-Text API.Issues related to the Speech-to-Text API.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.