Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speech API speechContexts not recognising arrays #2813

Closed
CharlotteGore opened this issue Apr 4, 2018 · 1 comment
Closed

Speech API speechContexts not recognising arrays #2813

CharlotteGore opened this issue Apr 4, 2018 · 1 comment
Assignees

Comments

@CharlotteGore
Copy link

Despite passing an array to speechContext.phrases, I am getting the following error:

ERROR: TypeError: .google.cloud.speech.v1.RecognitionConfig.speechContexts: array expected
    at Type.RecognitionConfig$fromObject [as fromObject] (eval at Codegen (/redacted/node_modules/@protobufjs/codegen/index.js:50:33), <anonymous>:55:9)
    at Type.fromObject (/redacted/node_modules/protobufjs/src/type.js:538:25)
    at Type.LongRunningRecognizeRequest$fromObject [as fromObject] (eval at Codegen (/redacted/node_modules/@protobufjs/codegen/index.js:50:33), <anonymous>:10:21)
    at Type.fromObject (/redacted/node_modules/protobufjs/src/type.js:538:25)
    at serialize (/redacted/node_modules/grpc/src/protobuf_js_6_common.js:70:23)
    at ServiceClient.Client.makeUnaryRequest (/redacted/node_modules/grpc/src/client.js:544:17)
    at apply (/redacted/node_modules/lodash/lodash.js:499:17)
    at ServiceClient.wrapper (/redacted/node_modules/lodash/lodash.js:5356:16)
    at /redacted/node_modules/@google-cloud/speech/src/v1/speech_client.js:175:39
    at timeoutFunc (/redacted/node_modules/google-gax/lib/api_callable.js:171:12)

Environment details

  • OS: OSX v10.11.6
  • Node.js version: v8.11.1
  • npm version: 5.6.0
  • google-cloud-node version: 196.0.0

Steps to reproduce

Code is here, it's mostly copied straight from the documentation. I have other code generating the real array but I tested it with the simplest possible array for testing and still getting the same result.

const config = {
  enableWordTimeOffsets: true,
  encoding: 'FLAC',
  sampleRateHertz: '16000',
  languageCode: 'en-GB',
  speechContexts: {
    phrases: ['dog', 'cat']
  }
};

const audio = {
  uri: 'gs://bucket/audio.flac'
};

const request = {
  config,
  audio,
};

client
  .longRunningRecognize(request)
  .then(data => {
    const operation = data[0];
    // Get a Promise representation of the final result of the job
    return operation.promise();
  })
  .then(data => {
    const response = data[0];
    console.log(`${JSON.stringify(response, null, 2)}`);
  })
  .catch(err => {
    console.error('ERROR:', err);
  });
@stephenplusplus
Copy link
Contributor

This issue was moved to googleapis/nodejs-speech#56.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants