Problem creating SpeechRecognizer with audio stream input using node.js Speech SDK

Michael Pickering 0 Reputation points
2025-06-05T09:01:51.1866667+00:00

Using Speech SDK for JavaScript v1.44.0, and following the STT in-memory streaming example, but using the fromEndpoint API to create Recognizer, as recommended in the Release Notes for that SDK version. Node.js is v22 LTS, running in Azure Cloud as an Azure Web App. Azure Speech Service is in France Central.

Describe the bug

Call to create the SpeechRecognizer with the following error information:

**/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/AudioConfig.js:184 return this.privSource.id(); ^

TypeError: this.privSource.id is not a function at AudioConfigImpl.id (/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/AudioConfig.js:184:32) at new ServiceRecognizerBase (/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ServiceRecognizerBase.js:63:88) at new SpeechServiceRecognizer (/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/SpeechServiceRecognizer.js:11:9) at SpeechRecognizer.createServiceRecognizer (/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/SpeechRecognizer.js:216:16) at SpeechRecognizer.implCommonRecognizerSetup (/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Recognizer.js:102:30) at new Recognizer (/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Recognizer.js:26:14) at new SpeechRecognizer (/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/SpeechRecognizer.js:26:9) at WebSocket. (/home/site/wwwroot/server.js:384:30) at WebSocket.emit (node:events:518:28) at Receiver.receiverOnMessage (/node_modules/ws/lib/websocket.js:1220:20)

Node.js v22.15.0**

To Reproduce

Create a node.js server in Azure Web App, create an Audio pushStream, then attempt to create a new SpeechRecognizer after a WebSocket client connects, like this:

  let pushStream = sdkSpeech.AudioInputStream.createPushStream(audioStreamFormat);

  // Get the audioConfig from STT Stream
  let audioConfig = sdkSpeech.AudioConfig.fromStreamInput(pushStream);

  // Prepare the recognizer
  let recognizeSTT = new sdkSpeech.SpeechRecognizer(speechConfig, audioConfig);

Expected behavior

Speech Recognizer is created and ready to recognize speech from the audio stream!

Version of the Cognitive Services Speech SDK

1.44.0

Platform, Operating System, and Programming Language

OS: Linux in Azure Web App with node.js 22 LTS Hardware - Whatever Azure is Using! Programming language: JavaScript (node.js) Browser - not applicable Additional context

The error crashes the node.js server, and the crash occurs AS SOON AS the call to create the SpeechRecognizer is sent and BEFORE sending any audio data to the STT service!

Version

1.36.0 (Latest)

What browser/platform are you seeing the problem on?

Node

Relevant log output

/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/AudioConfig.js:184
Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Suwarna S Kale 3,951 Reputation points
    2025-06-05T17:05:04.9666667+00:00

    Hello Michael Pickering,

    Thank you for posting your question in the Microsoft Q&A forum. 

    The error you are experiencing occurs due to incompatibility between Speech SDK v1.44.0 and Node.js v22 in Azure Web Apps, specifically when initializing SpeechRecognizer with push streams. This appears to be a regression bug affecting Linux environments. 

    Recommended solutions: 

    • Downgrade to SDK v1.36.0 for stability 
    • Test with fromDefaultMicrophoneInput() as temporary workaround 
    • Consider Windows-based App Service or container deployment 

    Next steps: 

    • Report the bug via Microsoft's GitHub issues 
    • Monitor for SDK patches in upcoming releases 
    • REST API may serve as interim solution 

    The Cognitive Services team is aware of similar streaming issues and working on a resolution. For production systems, SDK v1.36.0 remains the most reliable option currently. 

    If the above answer helped, please do not forget to "Accept Answer" as this may help other community members to refer the info if facing a similar issue. Your contribution to the Microsoft Q&A community is highly appreciated. 


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.