Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error unknown (2) when making UnaryCall call. #2057

Open
araisuki opened this issue Sep 13, 2024 · 4 comments
Open

Getting error unknown (2) when making UnaryCall call. #2057

araisuki opened this issue Sep 13, 2024 · 4 comments
Labels

Comments

@araisuki
Copy link

What are you trying to achieve?

Getting error unknown (2) when making UnaryCall call.

What have you tried so far?

The request doesn't seems to be reaching our server.

@glbrntt
Copy link
Collaborator

glbrntt commented Sep 13, 2024

Could you provide more information about what you're doing, how you're trying to do it and where you're seeing the error?

There isn't anything actionable we can do with the information you have provided.

@araisuki
Copy link
Author

araisuki commented Sep 13, 2024

@glbrntt This how my code is

let clientConnectionHost = SukiAmbientCoreManager.shared.environment.getSocketConntectionHost()
let clientConnectionPort = 443
micChannel = ClientConnection.usingPlatformAppropriateTLS(for: group)
            .connect(host: clientConnectionHost, port: clientConnectionPort)
sdpServiceClient = Suki_Pb_Sdp_SDPServiceNIOClient.init(channel: micChannel)
        sdpServiceClient.defaultCallOptions.customMetadata.add(name: "ambient_session_id", value: recordingId)
        sdpServiceClient.defaultCallOptions.customMetadata.add(name:"sdp_suki_token",
                                                               value: TokenManager.shared.getToken() ?? "")
        micChannel.connectivity.delegate = delegate

Below how I am making an GRPC call

var request = Suki_Pb_Sdp_AuthenticationRequest()
        request.partnerID = partnerId
        request.partnerToken = partnerToken
        let task = self.sdpServiceClient.authenticate(request)
        task.response.whenComplete { result in
            switch result {
            case .success(let response):
                completionHandler(.success(response))
                break
            case .failure(let error):
                print(error)
                completionHandler(.failure(error))
                break
            }
        }

Here how authenticate UnaryRPC looks like. This is compiler generated code.

internal func authenticate(
    _ request: Suki_Pb_Sdp_AuthenticationRequest,
    callOptions: CallOptions? = nil
  ) -> UnaryCall<Suki_Pb_Sdp_AuthenticationRequest, Suki_Pb_Sdp_AuthenticationResponse> {
    return self.makeUnaryCall(
      path: Suki_Pb_Sdp_SDPServiceClientMetadata.Methods.authenticate.path,
      request: request,
      callOptions: callOptions ?? self.defaultCallOptions,
      interceptors: self.interceptors?.makeAuthenticateInterceptors() ?? []
    )
  }

@araisuki
Copy link
Author

araisuki commented Sep 13, 2024

And also it happens only for my client using the app, If I use app with the same account it works fine. I suspect is it something to do with the network? But instead of unknown(2) error some valid error might be useful to understand

@glbrntt
Copy link
Collaborator

glbrntt commented Sep 13, 2024

unknown is a valid gRPC status code. It's possible the server returned an error with this status to the client.

Is there a message with the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants