Misty Community Forum

"Misty Reads” Skill with Microsoft Azure Issue

Hello,

I’m having issues when trying to use the “Misty Reads” Skill from this tutorial: /blog/setting-up-and-running-misty-reads-skill-with-microsoft-azure/

The code provided did not directly work with the Azure Function. I’m sending an external request as shown:

let azureURL = misty.Get("azureURL");
    
misty.SendExternalRequest("POST", azureURL, null, null, base64ToByteArrayString(baseImage));

After sending the external request, the data obtained from azure is the following:

{"data":{"data":"Please put image data in request body"},"message":"Calling command 'Debug'","timestamp":"2021-11-30T22:35:01.005772Z","truncated":false}

{"data":"Please put image data in request body","message":"'MistyReads' Debug => ","timestamp":"2021-11-30T22:35:01.005772Z","truncated":false}

which ends up giving an undefined value when trying to do .SaveAudioAssetToRobot() or .SaveAudio() or even the base64ToByteArrayString() function, which it leads to the following errors:

{"data":{"data":"Converting String"},"message":"Calling command 'Debug'","timestamp":"2021-11-30T22:35:01.005772Z","truncated":false}

{"data":"Converting String","message":"'MistyReads' Debug => ","timestamp":"2021-11-30T22:35:01.0214118Z","truncated":false}

{"data":{"data":"Couldn't convert to byte array: Error: 'atob' failed: The string to be decoded is not correctly encoded."},"message":"Calling command 'Debug'","timestamp":"2021-11-30T22:35:01.0214118Z","truncated":false}

{"data":{"fileName":"AzureResponse.wav","data":"undefined","immediatelyApply":true,"overwriteExisting":true},"message":"Calling command 'SaveAudioAssetToRobot'","timestamp":"2021-11-30T22:35:01.0370553Z","truncated":false}

At this point, I’m not sure if it is the azure function that is failing in returning a correct value or something in the code for Misty.