Azure-Samples / cognitive-services-speech-sdk

Sample code for the Microsoft Cognitive Services Speech SDK
MIT License
2.83k stars 1.83k forks source link

Error details: Connection failed (no connection to the remote host). Internal error: 1. Error details: Failed with error: #2394

Closed Gillter closed 1 month ago

Gillter commented 4 months ago

Code

import azure.cognitiveservices.speech as speechsdk speech_key = "my_speech_key" service_region = "eastus" speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region) speech_config.speech_synthesis_voice_name = "zh-CN-XiaoxiaoNeural" text = "你好,这是晓晓。" speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config) result = speech_synthesizer.speak_text_async(text).get() if result.reason == speechsdk.ResultReason.SynthesizingAudioCompleted: print("Speech synthesized for text [{}]".format(text)) elif result.reason == speechsdk.ResultReason.Canceled: cancellation_details = result.cancellation_details print("Speech synthesis canceled: {}".format(cancellation_details.reason)) if cancellation_details.reason == speechsdk.CancellationReason.Error: print("Error details: {}".format(cancellation_details.error_details))

Error

Speech synthesis canceled: CancellationReason.Error

Error details: Connection failed (no connection to the remote host). Internal error: 1. Error details: Failed with error: WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED

wss://eastus.tts.speech.microsoft.com/cognitiveservices/websocket/v1

X-ConnectionId: 4107f16adefe48c980828ae6d2b29c67 USP state: Sending. Received audio size: 0 bytes.

I followed the instruction https://learn.microsoft.com/zh-cn/azure/ai-services/speech-service/troubleshooting?tabs=curl#connection-closed-or-timeout

there is a error in validating your resource key. image

I am sure that I input correct speech_key and speech_region, however, it still occurs the bug.

Windows version: Windows 10 enterprise.

Kerry-LinZhang commented 3 months ago

@yulin-li could you please help to take a look?

yulin-li commented 3 months ago

WS_OPEN_ERROR_UNDERLYING_IO_OPEN_FAILED is the connection issue. And looks that it's an SSL issue. Maybe you can check e.g., if TLS 1.2 is enabled in your machine; if the system clock right; if you are using proxy that modified the cert.

The endpoint is right from the error message, and key authentication is after the underlying connection established.

github-actions[bot] commented 3 months ago

This item has been open without activity for 19 days. Provide a comment on status and remove "update needed" label.

pankopon commented 1 month ago

Closed as suggestions were given, no further updates received.