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
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)
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); }
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)
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
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 |
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.
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"]
3 People are following this question.