Hi,
Few months ago, I created a cloud script that adds virtual currency for the best players of the day. I was working flawlessly but since I added the possibility to login with a google account, I always get this error:
{ "TaskInstanceId": "xxxxxxxxxxx", "TaskIdentifier": { "Name": "Reward [Arena]", "Id": "xxxxxxxxxxx" }, "StartedAt": "2017-09-15T00:00:07.1367384", "CompletedAt": "2017-09-15T00:00:08.8337511", "Status": "Failed", "PercentComplete": null, "EstimatedSecondsRemaining": null, "ScheduledByUserId": null, "Result": { "FunctionName": "RewardArena", "Revision": 21, "FunctionResult": null, "FunctionResultTooLarge": null, "Logs": [], "LogsTooLarge": null, "ExecutionTimeSeconds": 0.4272996, "ProcessorTimeSeconds": 0, "MemoryConsumedBytes": 4294722104, "APIRequestsIssued": 6, "HttpRequestsIssued": 0, "Error": { "Error": "JavascriptException", "Message": "JavascriptException", "StackTrace": "TypeError: Cannot read property 'PlayFabId' of undefined\n at handlers.RewardArena (E53F-main.js:36:59)" } } }
Here is the concerned part of the code:
var getStatisticVersionsResult = server.GetPlayerStatisticVersions({ StatisticName: "BestDailyPlayer" }); var getStatisticVersionsResult = server.GetPlayerStatisticVersions({ StatisticName: "BestDailyPlayer" }); var version = getStatisticVersionsResult.StatisticVersions[0].Version; var useSpecific = false; if (version != 0) { useSpecific = true; } var getLeaderboardResult = server.GetLeaderboard({ StatisticName : "BestDailyPlayer", StartPosition : 0, MaxResultsCount : 3, UseSpecificVersion : useSpecific, Version: version }); SetVirtualCurrency(getLeaderboardResult.Leaderboard[0].PlayFabId, "02", 50); SetVirtualCurrency(getLeaderboardResult.Leaderboard[0].PlayFabId, "03", 1); SetVirtualCurrency(getLeaderboardResult.Leaderboard[1].PlayFabId, "02", 40); SetVirtualCurrency(getLeaderboardResult.Leaderboard[2].PlayFabId, "02", 35); SetVirtualCurrency(getLeaderboardResult.Leaderboard[3].PlayFabId, "02", 30); SetVirtualCurrency(getLeaderboardResult.Leaderboard[4].PlayFabId, "02", 25); SetVirtualCurrency(getLeaderboardResult.Leaderboard[5].PlayFabId, "02", 20); SetVirtualCurrency(getLeaderboardResult.Leaderboard[6].PlayFabId, "02", 18); SetVirtualCurrency(getLeaderboardResult.Leaderboard[7].PlayFabId, "02", 16); SetVirtualCurrency(getLeaderboardResult.Leaderboard[8].PlayFabId, "02", 14); SetVirtualCurrency(getLeaderboardResult.Leaderboard[9].PlayFabId, "02", 12);
P.S. The leaderboard length is always superior than 10 so it's not an index problem.
Thanks