question

heath avatar image
heath asked

Who do I generate an Extra API call for non-CloudScript endpoint?

The environment is Unity, WebGL build.

Any single call to a Client API Endpoint (other than ExecuteCloudScript) is duplicated, with a different Remote Address IP.

I see this in the Network tab of Chrome's dev tools.

Thanks,

-heathcarlisle

Example:

GetUserInventory - two OPTIONS and two POSTs, to two different remote addresses.

  1. Request URL:https://<gameid>.playfabapi.com/Client/GetUserInventory
  2. Request Method:OPTIONS
  3. Status Code:200 OK
  4. Remote Address:52.37.36.202:443
  5. Referrer Policy:no-referrer-when-downgrade
  1. Request URL:https://<gameid>.playfabapi.com/Client/GetUserInventory
  2. Request Method:POST
  3. Status Code:200 OK
  4. Remote Address:52.37.36.202:443
  5. Referrer Policy:no-referrer-when-downgrade

  6. Request URL:https://<gameid>.playfabapi.com/Client/GetUserInventory
  7. Request Method:OPTIONS
  8. Status Code:200 OK
  9. Remote Address:35.163.99.58:443
  10. Referrer Policy:no-referrer-when-downgrade

  11. Request URL:https://<gameid>.playfabapi.com/Client/GetUserInventory
  12. Request Method:POST
  13. Status Code:200 OK
  14. Remote Address:35.163.99.58:443
  15. Referrer Policy:no-referrer-when-downgrade
apisunity3d
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

It's possible that it's a retry in your http layer. First question though, did you edit out the Title ID for your game, or is it not set in your project? It should be the first part of your URLs for all calls to the service. The IP Address of the server is going to change quite often from call to call, as there are many API servers running in PlayFab, since we support over 50 million MAU at the moment (and still growing). On any given call, a load balancer is choosing where to route your request.

10 |1200

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

heath avatar image
heath answered

Thanks, Brendan - yes, I did replace the title string with <title> but I suppose the web form may have removed it thinking it was HTML.

I figured the host addresses may have been a load balancer, and subject to change. Both resolve to Amazon IP ranges.

I can confirm that the double calls DO NOT happen in the unity editor, but Debug.Log() statements do show them clearly in the WebGL context. Here is the trace for a single set of "doubled calls" with Debug.Log()'s in my script (PlayFabManager.cs, "PFMgr") and also on the internal "MakeApiCall" method in (PlayFabHTTP.cs, "PF HTTP"):

07:41:32.704 blob:http://192.168.10.5:8010/5e3843c8-7083-4557-beb9-538541e9f9e5:2 -

---------------------------------------------------PFMgr: getPlayerInventory UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object) UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[]) UnityEngine.Logger:Log(LogType, Object) UnityEngine.Debug:Log(Object) PlayFabManager:getPlayerInventory(Action, Action`1) <getPlayerData>c__AnonStorey14:<>m__0(GetPlayerCombinedInfoResult) System.Action`1:Invoke(Object) PlayFab.Internal.<MakeApiCall>c__AnonStorey0`1:<>m__1() System.Action:Invoke() PlayFab.Internal.<MakeApiCall>c__AnonStorey1:<>m__0(String) System.Action`1:Invoke(Object) PlayFab.Internal.<Post>c__Iterator0:MoveNext() UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/WebGL/runtime/DebugBindings.gen.cpp Line: 51)

07:41:32.711 blob:http://192.168.10.5:8010/5e3843c8-7083-4557-beb9-538541e9f9e5:2

--------------------------------------------------- PF HTTP !!!!/Client/GetUserInventory UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object) UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[]) UnityEngine.Logger:Log(LogType, Object) UnityEngine.Debug:Log(Object) PlayFab.Internal.PlayFabHttp:MakeApiCall(String, PlayFabRequestCommon, AuthType, Action`1, Action`1, Object, Dictionary`2, Boolean) PlayFab.PlayFabClientAPI:GetUserInventory(GetUserInventoryRequest, Action`1, Action`1, Object, Dictionary`2) PlayFabManager:getPlayerInventory(Action, Action`1) <getPlayerData>c__AnonStorey14:<>m__0(GetPlayerCombinedInfoResult) System.Action`1:Invoke(Object) PlayFab.Internal.<MakeApiCall>c__AnonStorey0`1:<>m__1() System.Action:Invoke() PlayFab.Internal.<MakeApiCall>c__AnonStorey1:<>m__0(String) System.Action`1:Invoke(Object) PlayFab.Internal.<Post>c__Iterator0:MoveNext() UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/WebGL/runtime/DebugBindings.gen.cpp Line: 51)

07:41:32.831 blob:http://192.168.10.5:8010/5e3843c8-7083-4557-beb9-538541e9f9e5:2

---------------------------------------------------PFMgr: getPlayerInventory UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object) UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[]) UnityEngine.Logger:Log(LogType, Object) UnityEngine.Debug:Log(Object) PlayFabManager:getPlayerInventory(Action, Action`1) <getPlayerData>c__AnonStorey14:<>m__0(GetPlayerCombinedInfoResult) System.Action`1:Invoke(Object) PlayFab.Internal.<MakeApiCall>c__AnonStorey0`1:<>m__1() System.Action:Invoke() PlayFab.Internal.<MakeApiCall>c__AnonStorey1:<>m__0(String) System.Action`1:Invoke(Object) PlayFab.Internal.<Post>c__Iterator0:MoveNext() UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/WebGL/runtime/DebugBindings.gen.cpp Line: 51)

07:41:32.837 blob:http://192.168.10.5:8010/5e3843c8-7083-4557-beb9-538541e9f9e5:2

--------------------------------------------------- PF HTTP !!!!/Client/GetUserInventory UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object) UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[]) UnityEngine.Logger:Log(LogType, Object) UnityEngine.Debug:Log(Object) PlayFab.Internal.PlayFabHttp:MakeApiCall(String, PlayFabRequestCommon, AuthType, Action`1, Action`1, Object, Dictionary`2, Boolean) PlayFab.PlayFabClientAPI:GetUserInventory(GetUserInventoryRequest, Action`1, Action`1, Object, Dictionary`2) PlayFabManager:getPlayerInventory(Action, Action`1) <getPlayerData>c__AnonStorey14:<>m__0(GetPlayerCombinedInfoResult) System.Action`1:Invoke(Object) PlayFab.Internal.<MakeApiCall>c__AnonStorey0`1:<>m__1() System.Action:Invoke() PlayFab.Internal.<MakeApiCall>c__AnonStorey1:<>m__0(String) System.Action`1:Invoke(Object) PlayFab.Internal.<Post>c__Iterator0:MoveNext() UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/WebGL/runtime/DebugBindings.gen.cpp Line: 51)

The timestamps have the two calls firing off within milliseconds of each other.

Here is the same trace in the Unity Editor:

---------------------------------------------------PFMgr: getPlayerInventory UnityEngine.Debug:Log(Object) PlayFabManager:getPlayerInventory(Action, Action`1) (at Assets/Scripts/Managers/PlayFabManager.cs:3612) <getPlayerData>c__AnonStorey14:<>m__0(GetPlayerCombinedInfoResult) (at Assets/Scripts/Managers/PlayFabManager.cs:2075) PlayFab.Internal.<MakeApiCall>c__AnonStorey0`1:<>m__1() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabHTTP.cs:177) PlayFab.Internal.<MakeApiCall>c__AnonStorey1:<>m__0(String) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWWW.cs:112) PlayFab.Internal.<Post>c__Iterator0:MoveNext() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWWW.cs:186) UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

UnityEngine.Debug:Log(Object) PlayFab.Internal.PlayFabHttp:MakeApiCall(String, PlayFabRequestCommon, AuthType, Action`1, Action`1, Object, Dictionary`2, Boolean) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabHTTP.cs:140) PlayFab.PlayFabClientAPI:GetUserInventory(GetUserInventoryRequest, Action`1, Action`1, Object, Dictionary`2) (at Assets/PlayFabSdk/Client/PlayFabClientAPI.cs:806) PlayFabManager:getPlayerInventory(Action, Action`1) (at Assets/Scripts/Managers/PlayFabManager.cs:3613) <getPlayerData>c__AnonStorey14:<>m__0(GetPlayerCombinedInfoResult) (at Assets/Scripts/Managers/PlayFabManager.cs:2075) PlayFab.Internal.<MakeApiCall>c__AnonStorey0`1:<>m__1() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabHTTP.cs:177) PlayFab.Internal.<MakeApiCall>c__AnonStorey1:<>m__0(String) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWWW.cs:112) PlayFab.Internal.<Post>c__Iterator0:MoveNext() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWWW.cs:186) UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

Showing, properly, only a single call..

Do you have any more information about "...Ia retry in your http layer."

Thanks for the help!

-heathcarlisle

@heath

@Brendan

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 ·

Yes, what I mean is that somewhere in the client code, it looks like the call is being made more than once, based upon the info you've sent. What I would recommend is that you put a breakpoint in the code where the actual SSL call is being made, so that you can check to see why each call to the service is being triggered.

0 Likes 0 ·

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.