Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by Brandon Phillips · May 12, 2019 at 04:55 AM · CloudScriptunity3dMatchmaking

Unable to call ExecuteCloudScript from Thunderhead server

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.

Comment
Brandon Phillips

People who like this

1 Show 5
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Brandon Phillips · May 13, 2019 at 03:17 AM 0
Share

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

avatar image jital ♦ · May 13, 2019 at 07:43 PM 0
Share

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?

avatar image Brandon Phillips jital ♦ · May 13, 2019 at 07:51 PM 0
Share

@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

avatar image ravarna Brandon Phillips · May 15, 2019 at 05:51 PM 0
Share

@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.

avatar image Brandon Phillips · May 15, 2019 at 09:31 AM 0
Share

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?

4 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

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
Comment
Brendan
TCROC

People who like this

2 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

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?

Comment

People who like this

0 Show 5 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Brandon Phillips · May 15, 2019 at 10:41 PM 0
Share
@Brendan

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)
avatar image Brendan ♦♦ Brandon Phillips · May 16, 2019 at 01:40 AM 0
Share

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?

avatar image Brandon Phillips Brendan ♦♦ · May 16, 2019 at 02:53 AM 0
Share

@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?

Show more comments
avatar image

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

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

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.

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    6 People are following this question.

    avatar image avatar image avatar image avatar image avatar image avatar image

    Related Questions

    [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

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges