question

gabebigboxvr avatar image
gabebigboxvr asked

PlayFab Not Working on Amazon Linux 2018.3

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

gabebigboxvr avatar image gabebigboxvr commented ·

I'm running into an issue where our game on Amazon Linux 2018.3 isn't allowing us to make server API calls.

Errors Making Server API Calls on Amazon Linux 2018.3

[NetworkingHost] Player joined from ::xxxxx       


[PlayerCharactersModelServer] failed to fetch for 3D717D800EC9282E 
/Server/GetAllUsersCharacters: Unknown Error                                   

[PlayerInventoryModelServer] failed to fetch data for 3D717D800EC9282E          /Server/GetUserInventory: Unknown Error

What is interesting is that the same code on Windows and same build on Ubuntu 16.04 work just fine.

I'm guessing there is a package missing that PlayFab requires, but it's not logging what broke. We are not using any 3rd party plugins. We're using the UnityWebRequest with CompressApiData on.

TitleID: CEA1

0 Likes 0 ·
gabebigboxvr avatar image gabebigboxvr commented ·

Correction: This is Amazon Linux 2018.03.

0 Likes 0 ·
gabebigboxvr avatar image gabebigboxvr commented ·

I've also turned off compression and nothing changed. I've gotten better logging and now I'm seeing this.

For some reason it's logging Service Unavailable?

[PlayerCharactersModelServer] failed to fetch for 3D717D800EC9282E
/Server/GetAllUsersCharacters PlayFabError(ServiceUnavailable, Unknown Error, 400 BadRequest)

[PlayerAccountModelServer] failed to fetch data for 3D717D800EC9282E
/Server/GetPlayerCombinedInfo PlayFabError(ServiceUnavailable, Unknown Error, 400 BadRequest)

[PlayerInventoryModelServer] failed to fetch data for 3D717D800EC9282E
/Server/GetUserInventory PlayFabError(ServiceUnavailable, Unknown Error, 400 BadRequest)
0 Likes 0 ·
gabebigboxvr avatar image
gabebigboxvr answered

I found the issue, this is caused by the certificate not being trusted on Amazon Linux due to how Mono checks certificate trusts.

Before any other call is made, you must provide your own CertificateValidator to override what Unity is doing by default.

PlayFabWebRequest.CustomCertValidationHook = ValidateCertificate;


public static bool ValidateCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{	
    // Implement your own certificate validation here
    return IsCertificateValid(certificate, chain, sslPolicyErrors);
}

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

The calls to PlayFab are simple Web API endpoints, so I can't imaging that there's something missing from the 2018.3 AMI that you'd need (assuming there aren't any incompatibilities with Unity - what version of that are you using?).

The error details you're getting are a little ambiguous, unfortunately. Can you give us some more details, like:

Title ID

API calls being made

Parameters passed into those calls

PlayFab ID of the user for that character

PlayFab SDK version

(and yes, Unity version)

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image brendan commented ·

Additional info for anyone running into this: We had some offline discussion concerning this issue, and it does look like this is a fundamental issue in Unity's networking stack. Gabe is following up with their team to see if they can determine how to resolve it.

1 Like 1 ·
gabebigboxvr avatar image
gabebigboxvr answered

Hi Brendan,

We confirmed that we're able to hit the PlayFab health endpoint, so not likely a networking issue.

$ curl https://cea1.playfabapi.com/healthstatus 

{"Healthy":true,"Vertical":"master","Application":"mainserver","Commit":"fde2c24","ConfigInstalled":true,"InstanceId":"i-031954adc5ddbc40b","DataIntegrityErrors":0}


TitleID: CEA1

Here's One Server API Call We're Making That's Failing

playFabId = 3D717D800EC9282E

PlayFabServerAPI.GetPlayerCombinedInfo(
                new GetPlayerCombinedInfoRequest()
                {
                    PlayFabId = playFabId, 
                    InfoRequestParameters = new GetPlayerCombinedInfoRequestParams()
                    {
                        GetUserAccountInfo = true,
                        GetPlayerProfile = true,
                        GetPlayerStatistics = true,
                        GetUserData = true,
                        GetUserReadOnlyData = true,
                    },
                },
                this.OnPlayFabResult,
                this.OnPlayFabError);

PlayFabID: 3D717D800EC9282E

PlayFab SDK Version: 2.53.181001

Unity Version: 2018.2.16f1

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

gabebigboxvr avatar image gabebigboxvr commented ·

Ok, I found the issue. I'm trying to see why the certificate is not trusted.

TlsException: Handshake failed - error code: UNITYTLS_INTERNAL_ERROR, verify result: UNITYTLS_X509VERIFY_FATAL_ERROR  
TrustFailure: WebException making http request to: https://CEA1.playfabapi.com/Server/GetAllUsersCharacters?sdk=UnitySDK-2.53.181001
1 Like 1 ·
brendan avatar image brendan commented ·

That's weird. Filtering on that call on your dashboard, I only see successful calls. Can you get a Wireshark capture of the exchange, so that we can see all the details?

0 Likes 0 ·
pengeeplayfabadmin avatar image
pengeeplayfabadmin answered

I had this problem (UNITYTLS_X509VERIFY_FATAL_ERROR) with every container (ubuntu, debian, etc). Implementing CustomCertValidationHook didn't work (I read this was only routed in ios, android and tvos maybe?) but found that updating apt, curl and installing ca-certificates to the container fixed it.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mirkosrsen avatar image
mirkosrsen answered

Dockerfile is the issue u need to instal certificates when building. Dockerfile should look like this:

FROM ubuntu:20.04

WORKDIR /game

ADD . .

RUN apt update

RUN apt install -y --reinstall ca-certificates

EXPOSE 7777/udp

CMD ["/game/Game.exe"]

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.