azuressl-certificateopenshiftazure-cognitive-services

Azure Speech SDK node.js fails to verify certificate


I have an azure container running in openshift in premise cluster. the routes set for example is https://speech.company.com

Now I have my node.js application hosted in same openshift (and also trying from my machine which is under same corporate network). but my speech sdk code emitting cancelled event for recognizer continuous Recognition.

Here's my sample snippet which i'm trying

let speechConfig = sdk.SpeechConfig.fromHost(new URL('wss://speech.company.com'))

....
const audioConfig = sdk.AudioConfig.fromStreamInput(stream) // consider i already have the audio stream here

const speechRecognizer = new sdk.SpeechRecognizer(speechConfig, audioConfig)
speechRecognizer.canceled = (s, e) => {
console.log('canceled:', e.errorDetails)
}

Output: canceled: Unable to contact server. StatusCode: 1006, undefined reason: unable to verify the first certificate

My .env is already has NODE_TLS_REJECT_UNAUTHORIZED=0 fyi - when i'm trying to open up a ws connection with ssl validate off from insomnia/postman, it's connecting. if it's on, then same unable to verify the first certificate i'm getting.

Not sure how to turn off from sdk. I'm not worried about ssl validation since everything is on-prem.

Question: how can i ignore ssl validation from the sdk? If not possible, how to attach certificate in sdk?

the code i just tried to mimic from actual code since it's on restricted device.


Solution

  • Ok. the solution has been found. since the whole infra was done in an enterprise setup, all the outbound call was going through a proxy.

    Speech container itself runs multiple services inside docker and localhost outbound call was also going through proxy. Which didn't have http 2.0 compatibility.

    The fix was to not use proxy when call is 127.0.0.1 aka localhost. We configured this through k8s yaml.