question

jnicholls avatar image
jnicholls asked

GetPlayerCombinedInfo returning 500 error

Hello

TitleId: 6C15

When a player logs into the game for the first time, a playfab account gets created and a facebook account is linked to the playfab account. Once this is done, it should call a function from cloudscript that would log the user into the game.

The cloudscript function fails the first time if a brand new playfab account has to be created but after that it works fine. The cloudscript function fails when calling

var data = server.GetPlayerCombinedInfo({
      PlayFabId: currentPlayerId,
      InfoRequestParameters: {
      GetPlayerProfile: true,
        GetUserReadOnlyData: true,
        ProfileConstraints: {
            ShowTags: true
        } 
      }
    });

The error that gets returned in the player stream is the following

{
    "EventName": "player_executed_cloudscript",
    "Source": "CloudScript",
    "FunctionName": "OnLogin",
    "CloudScriptExecutionResult": {
        "FunctionName": "OnLogin",
        "Revision": 5,
        "FunctionResult": null,
        "FunctionResultTooLarge": null,
        "Logs": [
            {
                "Level": "Debug",
                "Message": "\"In OnLogin!\"",
                "Data": null
            },
            {
                "Level": "Error",
                "Message": "PlayFab API request error",
                "Data": {
                    "api": "/Server/GetPlayerCombinedInfo",
                    "request": {
                        "PlayFabId": "AF6FB1646FB1DF6E",
                        "InfoRequestParameters": {
                            "GetPlayerProfile": true,
                            "GetUserReadOnlyData": true,
                            "ProfileConstraints": {
                                "ShowTags": true
                            }
                        }
                    },
                    "result": null,
                    "apiError": {
                        "code": 500,
                        "status": "InternalServerError",
                        "error": "InternalServerError",
                        "errorCode": 1110,
                        "errorMessage": "An unexpected error occured while processing the request.",
                        "errorHash": "360bf8bbdfedf032b86e4f3b72104fd1",
                        "errorDetails": {
                            "RequestID": [
                                "9f66c448c5924deca9b46fe3aed6c6f2"
                            ]
                        }
                    }
                }
            }
        ],
        "LogsTooLarge": null,
        "ExecutionTimeSeconds": 0.09381049999999999,
        "ProcessorTimeSeconds": 0,
        "MemoryConsumedBytes": 144960,
        "APIRequestsIssued": 1,
        "HttpRequestsIssued": 0,
        "Error": {
            "Error": "CloudScriptAPIRequestError",
            "Message": "The script called a PlayFab API, which returned an error. See the Error logs for details.",
            "StackTrace": "Error\n    at handlers.OnLogin (6C15-main.js:16:23)"
        }
    },
    "EventNamespace": "com.playfab",
    "EntityType": "player",
    "TitleId": "6C15",
    "EventId": "745dbe5d6a794e8995edac92c60b4507",
    "EntityId": "AF6FB1646FB1DF6E",
    "SourceType": "BackEnd",
    "Timestamp": "2017-08-02T17:22:54.573426Z",
    "History": null,
    "CustomTags": null,
    "Reserved": null
}

As said before the cloudscript function only errors out at that function when it is a brand user logging into the game for the first time with no playfab account.

Player Data
10 |1200

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

1 Answer

·
brendan avatar image
brendan answered

Thanks for letting us know about this. It does look like there's a corner case where you could get a null reference error getting the profile info via the API call. We'll track that down and get it fixed.

But that said, why not just use the InfoRequestParameters parameter in the Login... API call? That would return all the information you need as part of the login.

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.

jnicholls avatar image jnicholls commented ·

We cannot use the InfoRequestParameter since we are calling a function from cloud code called onlogin. This function gets called every time a user logs in. The onlogin function gets the user's profile and read only data using server.GetPlayerCombinedInfo, removes tags on the user if they have any, and generates the initial read only data that is specific for game to work and function properly based on the user's progress. We are using GetPlayerCombinedInfo since this allows us to get all the required information for the function and it also allows us to reduce the number of calls to playfab's api. Without the read only data on the user, the game will not work since the game gets rendered properly using the data that get initialized in the onlogin function. This is because in certain cases GetPlayerCombinedInfo will error out which causes the rest of the function to not work properly since read only data and player profile is not being returned at all.

Do you know if there’s a fix upcoming for this or a way to prevent this error from occurring in cloud script?

0 Likes 0 ·
brendan avatar image brendan jnicholls commented ·

To be clear, the error is not specific to Cloud Script - it's occurring because the call to retrieve the info is being made while the info is being created for the new account. Is it possible you're calling this Cloud Script handler from a Rule in PlayStream? If so, delaying this by having the OnLogin call triggered by the client may be sufficient to avoid the issue. Otherwise, I'd simply add a delay of one second before sending the ExecuteCloudScript call. The bug is on our backlog and will be addressed as soon as possible, but I can't say for certain when the fix will be live - we need to have someone reproduce the behavior first, and see what the cause is before we can determine the work required to fix it.

0 Likes 0 ·
jnicholls avatar image jnicholls brendan commented ·

Ok we will try that work around, we will keep an eye on it and let you know if the error persists.

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.