awslabs / amazon-kinesis-video-streams-webrtc-sdk-ios

iOS SDK for interfacing with the Amazon Kinesis Video Streams Signaling Service.
Apache License 2.0
66 stars 29 forks source link

Intermittent issue in getting AWSCredentials and iceserverlist. Error [Unexpected nil while unwrapping optional value] #56

Closed gkamath closed 2 years ago

gkamath commented 2 years ago

I have two issues while running the demo app in Unauthenticated mode.

Issue 1: In getSignedWSSUrl the AWSCredentials is nil as it is not able to fetch the credentials correctly. However when I increase the usleep to large value it is able to fetch the access, secret and session and get passed this issue.

Am I doing something wrong or is the async call taking more time ?

Note: I am running the app from PDT region, the master is in connected from PDT region to server in ap-northeast-1, the AWS resources are in ap-northeast-1 including kinesis, cognito etc.

Issue 2: Sometimes self.iceServerList is nil and fails to process successfully. This also works intermittently. I get the following error: Error to get ice server config: Error Domain=com.amazonaws.AWSKinesisVideoSignalingErrorDomain Code=0 "User: YYYY is not authorized to perform: kinesisvideo:GetIceServerConfig on resource: XXX" UserInfo={NSLocalizedDescription=User: YYYY is not authorized to perform: kinesisvideo:GetIceServerConfig on resource: XXX, NSLocalizedFailureReason=AccessDeniedException}

Here is what I tried:
I have also followed the suggestion #8 where I have used the following code to set credentialsProvider.

let credentialsProvider = AWSCognitoCredentialsProvider( regionType:.APNortheast1, identityPoolId:"xxxx", unauthRoleArn: "xxx, authRoleArn: "xxx", identityProviderManager: nil)

After AWSKinesisVideo.register I have credentialsProvider.clearCredentials() as suggested in #8.

in #8 it was mentioned guest login is not supported and I am assuming this feature is added now since #8 issue is pretty old. I have looked into #4 as well.

Let me know what I am missing and how to fix this issue.

disa6302 commented 2 years ago

@gkamath ,

Please make sure your master is in the same region as the resources. Closing. Feel free to reopen if you continue face issues after setting the region appropriately.