Share via

this.connect error from microsoft pronunciation assessment sdk

Hyojae Kim 5 Reputation points
2023-12-20T05:24:33.8833333+00:00

I am using Azure's pronunciation assessment sdk for a service I am developing. I am currently saving audio files in lambda's tmp folder for ephemeral access. My code works fine on my local environment (microsoft can access my local tmp folder just fine), but I receive this error when I deploy it to the dev environment. This is my code and error:
My logs look like this:

    let audioConfig
    try {
      if (fs.existsSync(filePath)) {
        console.log('File Path Found for audio config: ', filePath)
        fs.readdir('/tmp', (err, files) => {
          console.log('TMP DIR FILES:', files)
        })
        audioConfig = sdk.AudioConfig.fromWavFileInput(fs.readFileSync(filePath))

        console.log('audioConfig: ', audioConfig)
      } else {
        return reject(new Error('File not found: ' + filePath))
      }
    } catch (err) {
      return reject(new Error('Error reading file: ' + err))
    }

{
    "message": "Recognition not successful. Reason: Error Code: 4, Error Details: Unable to contact server. StatusCode: 1006, undefined Reason:  this.connect is not a function"
}

Azure AI Speech
Azure AI Speech

An Azure service that integrates speech processing into apps and services.


1 answer

Sort by: Most helpful
  1. Rohit Mungi 49,126 Reputation points Microsoft Employee Moderator
    2023-12-21T08:41:18.8333333+00:00

    @Hyojae Kim I think with lamda environment ( I am assuming it is AWS Lamda ), I am not sure if any additional setup is required with the SDK as compared to your local setup. But, in this case I think the first error code is now corrected as it was previously unable to connect to the endpoint. The new error seems to something that fails while processing your file input. A quick lookup of previous SDK issues indicates that a file object needs to be passed rather than file name. Please see the issue reference here.

    However, I would recommend raising an issue on the SDK repo for clarification of the error with details of the setup i.e environment and SDK used. Thanks!!

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    1 person found this answer helpful.
    0 comments No comments

Your answer

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