Hello, I encountered a strange error in my CloudScript and I need help. I am using automated tasks to back up my player's data to Amazon. The error I encountered was while using the Server version of WritePlayerEvent:
The code is here:
handlers.testAutomaticCloudScriptNightlyTestProvider = function (args, context) { log.debug("Test Provider's 3 key lists will be backed up. Then, Quests will be moved one at a time from Quests to either Pending or Completed.") // Send TestProvider's data to Amazon // automatic_backup_provider_quests_list var WritePlayerEventQuestsRequest = { "EventName": "automatic_backup_provider_quests_list", "PlayFabId": "FD0320648E13DFB1", "Body": "The Quest list will be here." }; log.debug("Request looks like " + WritePlayerEventQuestsRequest) log.debug("EventName is " + WritePlayerEventQuestsRequest.EventName) log.debug("PlayFabId is " + WritePlayerEventQuestsRequest.PlayFabId) server.WritePlayerEvent(WritePlayerEventQuestsRequest) return; }
The error is the following:
{ "EventName": "title_scheduled_cloudscript_executed", "Source": "CloudScript", "ScheduledTask": { "Name": null, "Id": null }, "FunctionName": "testAutomaticCloudScriptNightlyTestProvider", "CloudScriptExecutionResult": { "FunctionName": "testAutomaticCloudScriptNightlyTestProvider", "Revision": 192, "FunctionResult": null, "FunctionResultTooLarge": null, "Logs": [ { "Level": "Debug", "Message": "Test Provider's 3 key lists will be backed up. Then, Quests will be moved one at a time from Quests to either Pending or Completed.", "Data": null }, { "Level": "Debug", "Message": "Request looks like [object Object]", "Data": null }, { "Level": "Debug", "Message": "EventName is automatic_backup_provider_quests_list", "Data": null }, { "Level": "Debug", "Message": "PlayFabId is FD0320648E13DFB1", "Data": null }, { "Level": "Error", "Message": "PlayFab API request error", "Data": { "api": "/Server/WritePlayerEvent", "request": { "EventName": "automatic_backup_provider_quests_list", "PlayFabId": "FD0320648E13DFB1", "Body": "The Quest list will be here." }, "result": null, "apiError": { "code": 400, "status": "BadRequest", "retryAfterSeconds": null, "error": "InvalidParams", "errorCode": 1000, "errorMessage": "Invalid input parameters", "errorHash": null, "errorDetails": { "EventName": [ "The EventName field is required." ], "PlayFabId": [ "The PlayFabId field is required." ] } } } } ], "LogsTooLarge": null, "ExecutionTimeSeconds": 0.0169647, "ProcessorTimeSeconds": 0.002543, "MemoryConsumedBytes": 9384, "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.WritePlayerEvent (Script:636:73)\n at handlers.testAutomaticCloudScriptNightlyTestProvider (FEAAC-.CloudScript.js:1633:12)\n at Object.invokeFunction (Script:117:33)" } }, "EventNamespace": "com.playfab", "EntityType": "title", "EventId": "38008cb308f9411c9b4cedb680cede1c", "EntityId": "FEAAC", "SourceType": "BackEnd", "Timestamp": "2021-11-29T23:46:06.5296339Z", "History": [ { "ParentTriggerId": null, "ParentEventId": "68054620ce3944f085aa325d1bfa7d9a", "TriggeredEvents": false } ], "CustomTags": null, "Reserved": null, "PlayFabEnvironment": { "Vertical": "master", "Cloud": "main", "Application": "logicserver", "Commit": "f4e9e95" } }
"The EventName field is required."
"The PlayFabId field is required."
I am very confused, because as far as I can tell, I am setting the EventName and PlayFabId and I don't know any different way of doing that. Plus, this is how my other code is written and it's been working fine this whole time.
However, I've never called WritePlayerEvent from the server before so maybe this is an issue with this particular function?