Hi!
So, firstly, I am definitely sure that this worked at some point before.
I noticed that my cloudscript is not working correctly after I tried updating the Unity PlayFab SDK. I just did not pay attention to it for a while.
So, that's where my problems began.
I tried updating it through the extension and manually, but the version always remains 2.116 and shows that it can be upgraded to 2.118. I found a few threads related to this issue, but no solution.
My guess is that the following issue might be a result of the version difference.
No matter how I format the data that I use for an internal user data update request on the cloudscript, the Data field is reported as empty and the request throws an error when executing like so:
{ "EventName": "player_executed_cloudscript", "Source": "CloudScript", "FunctionName": "completedLevel", "CloudScriptExecutionResult": { "FunctionName": "completedLevel", "Revision": 48, "FunctionResult": null, "FunctionResultTooLarge": null, "Logs": [ { "Level": "Error", "Message": "PlayFab API request error", "Data": { "api": "/Server/UpdateUserInternalData", "request": { "PlayFabId": "D351F54068C9E532", "Data": {} }, "result": null, "apiError": { "code": 400, "status": "BadRequest", "retryAfterSeconds": null, "error": "InvalidParams", "errorCode": 1000, "errorMessage": "Invalid input parameters", "errorHash": null, "errorDetails": { "Data": [ "Must specify at least one of either Data or KeysToRemove." ] } } } } ], "LogsTooLarge": null, "ExecutionTimeSeconds": 0.0162076, "ProcessorTimeSeconds": 0.004892, "MemoryConsumedBytes": 269512, "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 Object.server_request (Script:181:24)\n at Object.server.UpdateUserInternalData (Script:628:79)\n at handlers.completedLevel (A76EE-main.js:5:39)\n at Object.invokeFunction (Script:117:33)" } }, "EventNamespace": "com.playfab", "EntityType": "player", "TitleId": "A76EE", "EntityId": "D351F54068C9E532", "EventId": "9f8bd388418649ce894b754c68e5ab86", "SourceType": "BackEnd", "Timestamp": "2021-12-03T19:14:31.1240327Z", "History": null, "CustomTags": null, "Reserved": null, "PlayFabEnvironment": { "Vertical": "master", "Cloud": "main", "Application": "logicserver", "Commit": "1ef4dca" } }
The cloud script function in question has been reduced to its' simplest possible version like so:
handlers.completedLevel = function (args, context) { var level = JSON.stringify(args.levelId); var updateUserDataResult = server.UpdateUserInternalData({ PlayFabId: currentPlayerId, Data: { lastLevelCompleted: level } }); }
I have tried formatting the data in many different ways and tried all the examples from the example github. No luck.
Is this because the SDK is not updated or because of something else?
Please advise.