Hi, when using the Server API, our server build can call PlayFabServerAPI.ExecuteCloudScript() just fine when running locally. However, when running the exact same build in a Thunderhead VM, we get the error "/Server/ExecuteCloudScript: Unknown Error" and the Cloud Script is never called. We're using the PlayFab Unity SDK and have the Server API enabled for our server builds.
Further information:
The exact code of the method call:
PlayFabServerAPI.ExecuteCloudScript(new ExecuteCloudScriptServerRequest{ FunctionName = "validateWinner", FunctionParameter = results.Select(item => new { ID = item.Key, SCORE = item.Value }), PlayFabId = playerScoreList[0].PlayFabID }, result => { Debug.Log ("SCRIPT RESULT OK: " + result.ToJson().ToStrnng()); }, error => { Debug.LogWarning("CLOUD SCRIPT ERROR: " + error.ToString()); });
This call works perfectly when running both inside the PlayFab MockVMAgent and running the server executable directly. However, when running it in Thunderhead the only error is:
/Server/ExecuteCloudScript PlayFabError(ServiceUnavailable, Unknown Error, 400 BadRequest)
According to this post it is a rare issue, however it happens on every single server instance we've run (we have so far tested over 50 instances with 100 clients in 1v1 games).
EDIT: I can also confirm that it happens on the latest SDK
Greetings,
This is something we are currently looking to with the new Unity SDK. Would you be able to provide your TitleID and any other pertinent information you think would be helpful?
@jital Sure, the TitleID is E39D6. Is there a reason why this wouldn’t be supported?
Also, I currently have no builds set up (as they use up our evaluation hours when not in use), but can create a new one if needed for testing
EDIT: I can also now confirm that this happens on both linux and windows VMs inside thunderhead
@Brandon Phillips are you able to call any Server API on Thundehead VMs? Are you having issues only with executing cloud script? That would be helpful information for us to debug.
Is there any resolve or update to this issue? If the Server API is not supported in Thunderhead, is there an alternative way of executive cloud script from a Thunderhead server?
Answer by Brandon Phillips · May 17, 2019 at 05:53 AM
@ravarna @Brendan I solved it! Installing curl to the container when building the container image fixes the issue and the Server API now runs as expected in Thunderhead (Linux).
Explanation:
I noticed that calls to the Server API would fail in a Linux-based container on my local machine as well as in Thunderhead (although not in Windows-based containers on my local machine). After trying to POST to the API myself using UnityWebRequest, I noticed that it produces the same "Unknown Error" when running in the container. As it turns out, both HttpWebRequest and UnityWebRequest (when using HTTPS) rely on Unity correctly setting up the certificate from the system, and produce "Unknown Error" when the cert isn't found.
I first attempted to symlink the cert inside the Ubuntu container, although that did not work. Then I learned that Unity-based execs use the system's installation of curl, which ubuntu containers don't have pre-installed. Installing curl will also (seemingly) link the correct location of the SSL cert needed for HTTPS calls to succeed when using WebRequest.
I'm not sure if there is a similar solution for Windows-based containers, although I would imagine that it is a similar problem in-that Windows Server Core is likely missing a default cert or policy that exists in home installs of Windows.
For anyone else experiencing similar issues and using docker to build their linux-based containers, add these lines to your Dockerfile:
RUN apt-get -y update RUN apt-get -y install curl wget
Answer by Brendan · May 15, 2019 at 10:22 PM
The "Unknown Error" you're getting is unrelated to the "ServiceUnavailable" error from the other thread you linked. Can you confirm what version of the GSDK you're using?
It is the C# GSDK version 0.9.190509.
@ravarna All calls to the Server API return the same error (when running in Thunderhead):
/Server/GetUserAccountInfo PlayFabError(ServiceUnavailable, Unknown Error, 400 BadRequest) /Server/GetUserInventory PlayFabError(ServiceUnavailable, Unknown Error, 400 BadRequest) /Server/ExecuteCloudScript PlayFabError(ServiceUnavailable, Unknown Error, 400 BadRequest)
Is this Unity 2018 or 2019? Unity's HTTP stack using TLS 1.2, which shouldn't have any issues. Can you send us the complete response packet you're getting? Also, can you try remoting into the machine and getting a network capture?
@Brendan Unity 2019.1.1f1, PlayFab Unity SDK 2.66.190509, using Unity Web Request as the Request Type.
I have a wireshark log from one of the containers in the Thunderhead VM which was started a few seconds before the calls were made and ends soon after, although the log is quite long. How should I send it to you?
Answer by ravarna · May 16, 2019 at 04:58 PM
@Brandon Phillips, I am guessing you made the postman call from the same vM where the calls are failing from within the game server. Regarding the errors, do they error out immediately or do they actually take some time (potential internal timeout). I am just trying to see if we have seen similar experiences from other customers
Answer by Brandon Phillips · May 16, 2019 at 05:53 PM
@ravarna You are correct, it is while remoted into the VM where the calls fail. The calls fail immediately and not after a period of time, so my guess is that it isn’t a network issue.
[VERY URGENT] Unity Matchmaking with Mirror cannot connect to server 2 Answers
Custom game server instance (unity) does not start 1 Answer
How would I use match-making (preview) for my game ? 1 Answer
Question about Matchmaking and some bits about CloudScript and Saving Game Data 0 Answers
Implementing Lobby notifications with C# and Microsoft.AspNetCore.SignalR.Client 1 Answer