SSLPeerUnverifiedException When starting the AWS Kinesis Webrtc stream for first time only

49 views Asked by At

Greetings to the one who is reading this and thanks for the help and time you are about to spend.

I am working with AWS kinesis Web RTC and trying to stream live video from a camera device but when the app is installed for the first time it crashes while creating the Connection with the exception below. If again I restart the device or restart the app it works fine. Tried out some solutions, I came across on various online platforms but was still not able to figure it out.

The code line on which it is happening is below

CODE:

val describeSignalingChannelResult = awsKinesisVideoClient?.describeSignalingChannel( DescribeSignalingChannelRequest() .withChannelName(channelName) )

Exception:

EXCEPTION: DefaultDispatcher-worker-1
                                                                                                 Process: com.secure56.app, PID: 26211
                                                                                                 com.amazonaws.AmazonClientException: Unable to execute HTTP request: Hostname kinesisvideo.ap-south-1.amazonaws.com not verified:
                                                                                                     certificate: sha1/------------------
                                                                                                     DN: CN=kinesisvideo.ap-south-1.amazonaws.com
                                                                                                     subjectAltNames: [kinesisvideo.ap-south-1.amazonaws.com]
                                                                                                    at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:456)
                                                                                                    at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:229)
                                                                                                    at com.amazonaws.services.kinesisvideo.AWSKinesisVideoClient.invoke(AWSKinesisVideoClient.java:2077)
                                                                                                    at com.amazonaws.services.kinesisvideo.AWSKinesisVideoClient.describeSignalingChannel(AWSKinesisVideoClient.java:930)
                                                                                                    at com.android56.app.onecam.kvs.SignallingDataCreator.updateSignallingChannelInfoTask(SignallingDataCreator.kt:158)
                                                                                                    at com.android56.app.onecam.kvs.SignallingDataCreator$updateSignallingChannelInfoTask$1.invokeSuspend(Unknown Source:15)
                                                                                                    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                                                                                                    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
                                                                                                    at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
                                                                                                    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
                                                                                                    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
                                                                                                    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
                                                                                                    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
                                                                                                    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
                                                                                                    Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@fb144, Dispatchers.IO]
                                                                                                 Caused by: javax.net.ssl.SSLPeerUnverifiedException: Hostname kinesisvideo.ap-south-1.amazonaws.com not verified:
                                                                                                     certificate: sha1/z60CQXD0myU9Ol4CyrQpESqcV3Y=
                                                                                                     DN: CN=kinesisvideo.ap-south-1.amazonaws.com
                                                                                                     subjectAltNames: [kinesisvideo.ap-south-1.amazonaws.com]
                                                                                                    at com.android.okhttp.internal.io.RealConnection.connectTls(RealConnection.java:1480)
                                                                                                    at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:1415)
                                                                                                    at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:1359)
                                                                                                    at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:221)
                                                                                                    at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:144)
                                                                                                    at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:106)
                                                                                                    at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:400)
                                                                                                    at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:333)
                                                                                                    at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:483)
                                                                                                    at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:135)
                                                                                                    at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:266)
                                                                                                    at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:219)
                                                                                                    at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:30)
                                                                                                    at com.google.firebase.perf.network.InstrURLConnectionBase.getOutputStream(InstrURLConnectionBase.java:165)
                                                                                                    at com.google.firebase.perf.network.InstrHttpsURLConnection.getOutputStream(InstrHttpsURLConnection.java:89)
                                                                                                    at com.amazonaws.http.UrlHttpClient.writeContentToConnection(UrlHttpClient.java:162)
                                                                                                    at com.amazonaws.http.UrlHttpClient.execute(UrlHttpClient.java:75)
                                                                                                    at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:386)

I am following the steps from sample app on github

Some details

def aws_version = '2.68.0' implementation("com.amazonaws:aws-android-sdk-kinesisvideo:$aws_version@aar") { transitive = true } implementation("com.amazonaws:aws-android-sdk-kinesisvideo-signaling:$aws_version@aar") { transitive = true } implementation("com.amazonaws:aws-android-sdk-kinesisvideo-webrtcstorage:$aws_version@aar") { transitive = true } implementation('org.glassfish.tyrus.bundles:tyrus-standalone-client:1.20') { exclude module: 'javax.inject' } implementation 'org.awaitility:awaitility:3.0.0'

0

There are 0 answers