Azure-Samples / cognitive-services-speech-sdk

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

Retrieving the Detailed Connection Error details from Speech SDK #604

Closed viju2008 closed 4 years ago

viju2008 commented 4 years ago

Hello,

I am trying to connect to an endpoint which has a Speech Container hosted.

However, I am getting connection errors and generic error message. "Connection failed (no connection to the remote host). Internal error: 1. Error details: 2460. Please check network connection, firewall setting, and the region name used to create speech". I need the exact reason. Possible issues could be TLS handshake issue, DNS resolution issues etc.

How do i get the detailed exception log of connection failure from the Speech SDK. I need the exact reason for the Connection failure as the container is behind a proxy with TLS to debug the issue.

How can i get the detailed connection error message from the SDK.

Regards,

rhurey commented 4 years ago

There are instructions here on how to enable logging from the Speech SDK: https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/how-to-use-logging

In the log file, I'd start with looking for lines containing SPX_TRACE_ERROR. There may be some spurious errors, but there should be enough to point you in the right direction. If you post a log, someone will be happy to take a look at it to help out.

viju2008 commented 4 years ago

I am getting tls verify fail error. I have two options as it development.. How do i bypass tls verification .

I am trying in android

Second how do i provide the CA certificate required so that if such issue occurs with self hosted containers(via middle server) then providing the CA cert dynamically to the SpeechConfig would be needed

I tried opening the endpoint in browser . The browser is able to verify the certificate

viju2008 commented 4 years ago

logfile.txt

rhurey commented 4 years ago

Was the certificate issued by a CA that isn't part of the standard root certificates in the Android store?

For test devices the solution would be to install the CA from your issuer as a trusted root. For production it would be to get a certificate issued by a universally trusted CA. (This assumes the validation issues is a root trust issue and not a name mismatch or some other certificate problem)

viju2008 commented 4 years ago

The certificate is verifiable through browser on the same mobile so this means the certiticate is trusted in Android store else the browser also would not have verified it.

Can you tell me from error log whether its chain of trust error or is it some other certificate issue.. browser dosent show anything wrong with the certificate on same mobile

Certificate is valid till july 2021. It is a proper certiticate it is not self-signed

It may also be a mismatch of cipher suite issue. Can you help me get the exact tls issue

viju2008 commented 4 years ago

Also a peculiar situation that i noticed .. If i am calling my websocket proxy from a Java 99program JRE 1.8 on my desktop i am not getting TLS verification issues.

I am only getting it on android phone . Hence it seems the android phone is missing the CA certificates. However in production its not possible to add any certificate to the keystore of the client, hence some other way of passing CA certificate to SDK needs to be available.

Is there any setting to increase the log level on Android phone

It seems there is some bug in the Android SDK for custom hosted endpoint for wss connection

pankopon commented 4 years ago

Duplicate of https://github.com/Azure-Samples/cognitive-services-speech-sdk/issues/614.