Text to speech ressource : Unable to contact server. StatusCode: 1006, undefined Reason: Unexpected server response: 401

Seth 10 Reputation points
2023-05-03T23:55:06.8166667+00:00

Hello

I notice an impossibility to use the "text to speech" service since at least Wednesday, May 4, from 3pm.

My last successful use was on Tuesday, May 2, 23:29 (French time).

I use in all my programs a code similar to the one attached below (partially anonymous key here with XXX).

Modejs environment as a console application or web API:


« 
(function() {

    "use strict";

    /***DEBUG
     * 
     * 
     * curl -v -X POST "https://francecentral.api.cognitive.microsoft.com/sts/v1.0/issuetoken" -H "Ocp-Apim-Subscription-Key: 5d9bdc5da0304409929bc787e1a44087" -H "Content-type: application/x-www-form-urlencoded" -H "Content-Length: 0"

     * 
     * 
     */

    var sdk = require("microsoft-cognitiveservices-speech-sdk");
    var readline = require("readline");

    var audioFile = "YourAudioFile.wav";
    // This example requires environment variables named "SPEECH_KEY" and "SPEECH_REGION"
    const speechConfig = sdk.SpeechConfig.fromSubscription("5d9bdc5dXXXXX", "francecentral");
    const audioConfig = sdk.AudioConfig.fromAudioFileOutput(audioFile);

    // The language of the voice that speaks.
    speechConfig.speechSynthesisVoiceName = "en-US-JennyNeural"; 

    // Create the speech synthesizer.
    var synthesizer = new sdk.SpeechSynthesizer(speechConfig, audioConfig);

    var rl = readline.createInterface({
      input: process.stdin,
      output: process.stdout
    });

    rl.question("Enter some text that you want to speak >\n> ", function (text) {
      rl.close();
      // Start the synthesizer and wait for a result.
      synthesizer.speakTextAsync(text,
          function (result) {
        if (result.reason === sdk.ResultReason.SynthesizingAudioCompleted) {
          console.log("synthesis finished.");
        } else {
          console.error("Speech synthesis canceled, " + result.errorDetails +
              "\nDid you set the speech resource key and region values?");
        }
        synthesizer.close();
        synthesizer = null;
      },
          function (err) {
        console.trace("err - " + err);
        synthesizer.close();
        synthesizer = null;
      });
      console.log("Now synthesizing to: " + audioFile);
    });
}());
 »

the result when calling the endpoint is always the same, including in the SSML call version:

« 
Unable to contact server. StatusCode: 1006, undefined Reason:  Unexpected server response: 401
SpeechSynthesisResult {
  privResultId: 'F9C152F0F9414887BB913EDEDD181E5A',
  privReason: 1,
  privAudioData: undefined,
  privErrorDetails: 'Unable to contact server. StatusCode: 1006, undefined Reason:  Unexpected server response: 401',
  privProperties: PropertyCollection {
    privKeys: [ 'CancellationErrorCode' ],
    privValues: [ 'ConnectionFailure' ]
  }
}

 »

I saw this problem simultaneously in several applications using the same resource "SethSpeech (Speech Recognition Services). And the problem appeared simultaneously on my production environments and on my development machine, on Wednesday, May 3rd, around 3 p.m. I I hadn't made any code changes, or my configuration on the azure portal since the previous day or all my production applications and on my development machine were still functional.

I specify that the limit of my azure plan was far from being reached (start of cycle)

I tried the following resolutions:

1°) Uninstalling and reinstalling the npm package microsoft-cognitiveservices-speech-sdk

In different versions previously running on my environments including 1.13, 1.27.0 and 1.28.0

2°) repeatedly reset keys in the azure portal

3°) creation of a new resource from scratch “sethSpeech2”

In any case, a curl confirmed that I was using the correct speech_key and speech_region

However, in all cases, the code executed: synthesizer.speakTextAsync(

Systematically sent me a: “Speech synthesis canceled, Unable to contact server. StatusCode: 1006, undefined Reason: Unexpected server response: 401”

I've locked everything approaching I could find on the web and here, but nothing that can fix the problem that seems directly related to a call mismatch using npm microsoft-cognitiveservices-speech -sdk

Should a particular SDK version be preferred to restore service via modejs?

If anyone has a solution..?

Sincerely, Seth

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
1,475 questions
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
2,517 questions
{count} vote

1 answer

Sort by: Most helpful
  1. VasaviLankipalle-MSFT 15,246 Reputation points
    2023-05-05T17:31:59.9266667+00:00

    Hi @Seth , Sorry for all the inconveniences.

    As mentioned earlier, this could be due to the outage affecting your scenario as well. I believe everything should work normally now.

    As the outage in the FranceCentral region has been resolved. Services are running well. Could you please try now and let us know if you still face these issues?

    Additionally, I would suggest you create custom service health alerts if you haven't to stay updated about Azure service issues: https://aka.ms/ash-videos for video tutorials and https://aka.ms/ash-alerts for how-to documentation.

    I hope this helps.

    Regards,
    Vasavi

    -Please kindly accept the answer and vote 'Yes' if you feel helpful to support the community, thanks.

    0 comments No comments