Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by davidruiz · Feb 20, 2018 at 06:03 PM · apisCloudScriptunity3d

Server/RedeemMatchmakerTicket working on Unity Editor, not in Android device

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.

editorlog.png (12.1 kB)
logcat.png (25.5 kB)
Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Brendan · Feb 20, 2018 at 11:33 PM

Can you describe in more detail what you're trying to create, exactly? RedeemMatchmakerTicket is for use with custom game servers (https://api.playfab.com/docs/tutorials/landing-tournaments/custom-game-servers), not Cloud Script.

Comment

People who like this

0 Show 1 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image davidruiz · Feb 21, 2018 at 03:09 PM 0
Share

Nevermind, I forgot I'm using an obfuscator when building, so it messed up the API calls. I disabled it and now it's working correctly. I'll try to tweak the Obfuscator to prevent it from messing up these calls.

What I'm trying to do is register my Photon's games with the Playfab Matchmaker in order to monitor them and be able to get the list of games that are interesting for a specific user (for instance a statistic-based matchmaking, Facebook friend games, etc) before even connecting to Photon.

Thank you!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    1 Person is following this question.

    avatar image

    Related Questions

    UserData object different between client and server? 1 Answer

    executecloudscript unity Function Parameter 1 Answer

    Saving data in Unity on Pause/Quit/Lose Focus 1 Answer

    [UNITY] Help with returning/parsing results of ExecuteCloudScriptResult 1 Answer

    In CloudScript: can I access Days, Hours, Minutes from a date? 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges