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

C# - RpcAsync called with HttpKey+Payload does not execute as a POST request #26

Open
novabyte opened this issue Apr 25, 2020 · 5 comments
Assignees
Labels

Comments

@novabyte
Copy link
Member

As a workaround its possible to add the attached extension method to the IClient type which will enable usage which looks like:

var payload = new Dictionary<string, string>
{
    {"foo", "bar"}
};
try
{
    var rpcResponse = await _client.RpcAsyncPost(HttpKey, RpcId, payload.ToJson());
    Debug.LogFormat("rpcResponse: {0}", rpcResponse);
}
catch (ApiResponseException e)
{
    Debug.LogException(e);
}

A proper fix should be implemented in the code generator for the client sdk to handle this special case logic.

RpcHttpKeyExtensions.cs.txt

@novabyte novabyte added bug Something isn't working good first issue Good for newcomers labels Apr 25, 2020
@novabyte novabyte self-assigned this Apr 25, 2020
@ShadowFactoryTeam
Copy link

We're using the provided RpcHttpKeyExtensions.cs and until now it was working perfectly!

We've just rolled out HTTPS support across our solutions and we're getting an issue with the only implementation that uses RPCAsyncPost. The returned exception is Cert handshake failed. verify result: UNITYTLS_X509VERIFY_FATAL_ERROR.

@novabyte
Copy link
Member Author

@ShadowFactoryTeam I took another look at the extension code I'd written to refresh it in my mind. There's nothing in it that does anything different to the rest of the SDK. It uses the same UnityWebRequestAdapter.Instance as all the other SDK functions would.

Can you share code for how you initialize the Client type in your project?

@ShadowFactoryTeam
Copy link

There's no difference with how we initialize

public Client Client
{
    get
    {
        if (_client == null)
        {
            _client = new Client(_httpScheme, _ipAddress, _port, _authSocketString, UnityWebRequestAdapter.Instance);
        }
        return _client;
    }
}

This particular function with the issue is run on headless unity servers, we now believe it has to do with another issue that plagues Linux / Unity projects outlined here - https://forum.unity.com/threads/ubuntu-headless-build-tls-handshake-fails.546704/

@novabyte
Copy link
Member Author

@ShadowFactoryTeam I had a read of the issue on that forum thread and it looks like what you'll need to do:

  1. Make sure the curl package is installed on the base distro that your headless instances are running on.
  2. Figure out where the certificate store is on your base distro and symlink it to the location that Unity expects to find it at startup.

Hope that helps.

@ShadowFactoryTeam
Copy link

@novabyte the missing CURL package was indeed the issue. Thanks for helping.

@lugehorsam lugehorsam reopened this Sep 21, 2022
@lugehorsam lugehorsam added C# and removed bug Something isn't working good first issue Good for newcomers labels Sep 21, 2022
@lugehorsam lugehorsam changed the title RpcAsync called with HttpKey+Payload does not execute as a POST request C# - RpcAsync called with HttpKey+Payload does not execute as a POST request Sep 21, 2022
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

3 participants