Hi,
I'm trying to make a matchmaking system and when I get to the point to validate the ticket retrieved from Client.Matchmake I try to validate it calling ExecuteCloudScript which executes a "redeemMatchmakerTicket" function in my cloudscript. Here's the cloudscript code:
handlers.redeemMatchmakerTicket = function(args, context) { log.info("LobbyId received: " + args.LobbyId); log.info("Ticket received: " + args.Ticket); var redeemMatchmakerTicketResult = server.RedeemMatchmakerTicket({ LobbyId : args.LobbyId, Ticket : args.Ticket }); return redeemMatchmakerTicketResult; };
And this is my C# code to call this cloudscript function:
private void RedeemMatchmakerTicket(string lobbyId, string ticket) { Debug.Log(ticket); PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest() { FunctionName = "redeemMatchmakerTicket", GeneratePlayStreamEvent = true, FunctionParameter = new { Ticket = ticket, LobbyId = lobbyId } }, OnTicketRedeemed, HandlePlayFabError); }
I get the lobbyId and the ticket from the Matchmake call.
Now, this works perfectly in the editor, here's a screen of the console log:
And when I build and try on an Android device, this occurs:
This is the error log in my Dashboard PlayStream:
{ "EventName": "player_executed_cloudscript", "Source": "CloudScript", "FunctionName": "redeemMatchmakerTicket", "CloudScriptExecutionResult": { "FunctionName": "redeemMatchmakerTicket", "Revision": 17, "FunctionResult": null, "FunctionResultTooLarge": null, "Logs": [ { "Level": "Info", "Message": "LobbyId received: 10708125309171672530", "Data": null }, { "Level": "Info", "Message": "Ticket received: undefined", "Data": null }, { "Level": "Error", "Message": "PlayFab API request error", "Data": { "api": "/Server/RedeemMatchmakerTicket", "request": { "LobbyId": "10708125309171672530" }, "result": null, "apiError": { "code": 400, "status": "BadRequest", "error": "InvalidParams", "errorCode": 1000, "errorMessage": "Invalid input parameters", "errorHash": null, "errorDetails": { "Ticket": [ "The Ticket field is required." ] } } } } ], "LogsTooLarge": null, "ExecutionTimeSeconds": 0.12422559999999999, "ProcessorTimeSeconds": 0.016, "MemoryConsumedBytes": 57960, "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.redeemMatchmakerTicket (99-main.js:27:44)" } }, "EventNamespace": "com.playfab", "EntityType": "player", "TitleId": "99", "EventId": "98cba57ed6264e6d94d460683f2e34d9", "EntityId": "F354F89420254BA2", "SourceType": "BackEnd", "Timestamp": "2018-02-20T07:09:06.2293408Z", "History": null, "CustomTags": null, "Reserved": null }, { "EventName": "player_executed_cloudscript", "Source": "CloudScript", "FunctionName": "deregisterGame", "CloudScriptExecutionResult": { "FunctionName": "deregisterGame", "Revision": 17, "FunctionResult": { "Message": {} }, "FunctionResultTooLarge": null, "Logs": [ { "Level": "Info", "Message": "LobbyId received: 10708125309171672530", "Data": null } ], "LogsTooLarge": null, "ExecutionTimeSeconds": 0.0871358, "ProcessorTimeSeconds": 0.016, "MemoryConsumedBytes": 28488, "APIRequestsIssued": 1, "HttpRequestsIssued": 0, "Error": null }, "EventNamespace": "com.playfab", "EntityType": "player", "TitleId": "99", "EventId": "68d143d578f24b01b36203abd7f1b6d2", "EntityId": "F354F89420254BA2", "SourceType": "BackEnd", "Timestamp": "2018-02-20T07:09:06.7038029Z", "History": null, "CustomTags": null, "Reserved": null }
So clearly there's something wrong when I try to send the ticket to the back-end. But just before I make the ExecuteCloudScript call I log the value and it's fine.
Any ideas? Thank you for your time.