Cognitive-services-speech-sdk: .net-core WebSocket Upgrade failed with a bad request (400)

Created on 24 Aug 2018  路  3Comments  路  Source: Azure-Samples/cognitive-services-speech-sdk

All of the sudden I experience the following error:
WebSocket Upgrade failed with a bad request (400). Please check the language name and deployment id, and ensure the deployment id (if used) is correctly associated with the provided subscription key.

I provided the right subscription key and also the right location. Here's the code im using:

var stream = new MemoryStream(audioData);
stream.WriteWavHeader(false, 1, 16, 16000, audioData.Length / 2);

var factory = SpeechFactory.FromSubscription("key", "northeurope");
using (var recognizer = factory.CreateSpeechRecognizerWithStream(new BinaryAudioStreamReader(
    new AudioInputStreamFormat
    {
        FormatTag = 1,
        BitsPerSample = 16,
        BlockAlign = 2,
        Channels = 1,
        SamplesPerSec = 16000,
        AvgBytesPerSec = 32000
    }, stream), language))
{
    // only for single shot recognition like command or query. For long-running recognition, use
    // StartContinuousRecognitionAsync() instead.
    var recognitionResult = await recognizer.RecognizeAsync();

    ...
}

Am I doing something wrong? It worked two weeks ago or so

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

see above

Any log messages given by the failure

WebSocket Upgrade failed with a bad request (400). Please check the language name and deployment id, and ensure the deployment id (if used) is correctly associated with the provided subscription key.

Expected/desired behavior

Everything works fine and I get my speech recognition result

OS and Version?

Windows 10 (on Parallels AND also on Azure App Service)

Versions

SDK .net-core versions 0.5.0 (Communication Error 400) and 0.6.0 (see error message above

Most helpful comment

Hi I am seeing this WebSocket Upgrade failed with a bad request 400 issue and I am certain my keys and setup is correct. What can be causing this issue?

All 3 comments

we found an issue between client and service that could create in rare circumstances a problem reported as an upgrade failure. this has been fixed on the service and in an upcoming sdk version (soon available)

there is the issue of concurrent connections - these are limited for the free as well as for the 'paid' keys. If you exceed your concurrent connection limit, this might currently also get reported as an upgrade issue. In the future we will have better reporting here ...

Wolfgang

closing this one
please open a new issue if you encounter an issue with the 1.0 (or later) bits

Hi I am seeing this WebSocket Upgrade failed with a bad request 400 issue and I am certain my keys and setup is correct. What can be causing this issue?

Was this page helpful?
0 / 5 - 0 ratings