2

currently I am creating an STT application using

  • NodeJS v16.x
  • microsoft-cognitiveservices-speech-sdk v1.17.0

I have created an azure Speech Cognitive resource in the region westeurope and verified the key is correct.

Now I am using the following code to perform speech recognition:


class RecognizerAzure {

  recognize(){
    this.audioFormat = AudioStreamFormat.getWaveFormatPCM(sampleRate, 16, 1)
    this.pushStream = AudioInputStream.createPushStream(this.audioFormat)
    this.audioConfig = AudioConfig.fromStreamInput(this.pushStream)
    this.speechConfig = SpeechConfig.fromSubscription(
      '*************',
      'westeurope'
    )
    this.speechConfig.speechRecognitionLanguage = "en_US"

    this.recognizer = new SpeechRecognizerMicrosoftAzure(
      this.speechConfig,
      this.audioConfig
    )

    this.recognizer.startContinuousRecognitionAsync(() => {
      if (this.recognizer) {
        console.debug(inspect(this.recognizer))
        this.recognizer.canceled = console.log
      }
    }, this.logger.warn)
  }

the recognizer will then just log an event with the message Unable to contact server. StatusCode: 1006, undefined Reason: Unsupported type: object at: (shallow). I have created a speech service according to the azure docs and implemented this code as defined in the sample implementation in Azure portal.

Sadly this error message is not very helpful to me nor am I able to find anything in the Azure KnowlegeBase.

Does anybody else have the same problem?

Jennifer Marsman - MSFT
  • 5,167
  • 1
  • 25
  • 24
TheDome
  • 343
  • 3
  • 10
  • You can refer to similar issues: [Unable to contact server. StatusCode: 1006, undefined Reason](https://github.com/Azure-Samples/cognitive-services-speech-sdk/issues/292), [Error: azure speech recognition stream cancelled with error: 4 Unable to contact server. StatusCode: 1006](https://github.com/microsoft/cognitive-services-speech-sdk-js/issues/296#issuecomment-849423282) and [Unable to contact server. StatusCode: 1006, undefined Reason. Error Code: 7](https://github.com/microsoft/cognitive-services-speech-sdk-js/issues/94) – Ecstasy Feb 01 '22 at 05:44
  • Thank you! I have seen these Issues. However these issues all end with an "undefined reason" while I get an "Unsupported type: object at: (shallow)", which confuses me since this is not documented in the Azure docs. – TheDome Feb 01 '22 at 09:29
  • Hi this is Darren from the Speech SDK team. Please load this page to check websocket connection and let me know if that works: http://websocketstest.com/ . Also does the Speech SDK JavaScript recognition demo page work for you: https://azure.microsoft.com/en-us/services/cognitive-services/speech-to-text/#features – Darren Cohen Feb 02 '22 at 18:47
  • Hi Darren, thanks for helping me out! The demos both work for me. However this issue is related to the NodeJS version of speech-sdk so maybe there could be the problem? Since you are already here: is there a switch to turn on verbose logging? – TheDome Feb 03 '22 at 08:10

2 Answers2

1

I solved this by changing the subscription key.

Azure was showing the wrong subscription key on the Speech Services Overview page. "Key 1" and "Key 2" was showing the same key, which turned out to be "Key 2".

However, the keys are also available in the "Keys and Endpoint" section, but here "Key 1" had another value, which worked for me.

theisof
  • 671
  • 6
  • 6
0

I was able to solve this issue by explicitly setting manual resolutions using my package.json. This seems to originate from the Certificate Methods used in asn1.js. Thanks for your help. I added this line there:

{
  "resolutions": {
    "microsoft-cognitiveservices-speech-sdk/**/asn1.js": "5.4.1"
  }
}
TheDome
  • 343
  • 3
  • 10