question

maximelaffaire avatar image
maximelaffaire asked

RemoveFriend is not always working

Hi,

I have two accounts (let's call them A and B).

A is friend with B and B is friend with A. I know that because when I call GetFriendList, both appears in each other friend list.

When I try to remove that friendship in my cloudscript, playfab throw an error without any data inside.

So far I'm sure that the problem doesn't come from the application itself, since it's working with other friendship and/or other accounts (for example I can remove the friendship between A and another account C, or between B and C, or between C and another account D).

I don't think it's coming from my cloudscript neither since I executed it from the dashboard and have the same result when I try to remove the friendship between A and B (error) but a success when it's about A and C, B and C ...

I believe A and B are friends for a "long" time (probably a month or two).

Here is my function and its result, thank you for reading

handlers.removeFriend = function(args)
{
	var friendId = args.FriendPlayFabId;
	var succeed = true;
	try {
		server.RemoveFriend({PlayFabId : currentPlayerId, FriendPlayFabId : friendId});
	}
	catch (err) {
		succeed = false;
	}

	try {
		server.RemoveFriend({PlayFabId : friendId, FriendPlayFabId : currentPlayerId});
	}
	catch (err) {
		succeed = false;
	}
	return {hasBeenRemoved:succeed};
};


and the result I got when I execute it from the dashboard :

{
    "FunctionResult": {
        "hasBeenRemoved": false
    },
    "Logs": [
        {
            "Level": "Error",
            "Message": "PlayFab API request error",
            "Data": [
                [
                    []
                ],
                [
                    [
                        [
                            []
                        ],
                        [
                            []
                        ]
                    ]
                ],
                [
                    []
                ],
                [
                    [
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ]
                    ]
                ]
            ]
        },
        {
            "Level": "Error",
            "Message": "PlayFab API request error",
            "Data": [
                [
                    []
                ],
                [
                    [
                        [
                            []
                        ],
                        [
                            []
                        ]
                    ]
                ],
                [
                    []
                ],
                [
                    [
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ]
                    ]
                ]
            ]
        }
    ],
    "ExecutionTimeSeconds": 0.1521986,
    "MemoryConsumedBytes": 121544,
    "APIRequestsIssued": 2,
    "HttpRequestsIssued": 0,
    "Error": null
}

CloudScriptFriends
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

What are the specific values you're passing into the Cloud Script, and what Title ID is this for? Just so you know, there's no difference between calling a Server API method via Cloud Script or from Postman, etc., so you can also see the results by trying that tool. The output looks like an issue with the way the Game Manager is returning the results, so we'll have a look at that.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

maximelaffaire avatar image maximelaffaire commented ·

Hi,

The title ID where the bug appeared is 51A9 (alpha version), but I believe it happened one time on the dev version 8FCB.

If I remember well the currentPlayerId was 9F34D34214BDD6AC and the argument friendId was 8F0747F648EA4119.

Sorry it took a long time to reply !

0 Likes 0 ·
brendan avatar image
brendan answered

I see the issue - whenever a Server API call is failing from within Cloud Script, there is an error log automatically being generated. It seems that the Game Manager is not able to show that error output correctly at the moment, so I've opened a bug for that to get fixed as soon as possible.

Right now, you can see your error output by adding this line to your catch clauses:

log.info(JSON.stringify(err));
6 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

maximelaffaire avatar image maximelaffaire commented ·

Thanks @Brendan, I'm going to test that. However, I can't reproduce the bug at will and somehow removing each account (A and B from my original post) from each friend list worked yesterday, did your team fixed anything ?

0 Likes 0 ·
brendan avatar image brendan maximelaffaire commented ·

No, we haven't changed anything. But it's actually easy to reproduce - just try removing a friend twice. The first time works, while the second time returns an error (which shows the issue)

0 Likes 0 ·
maximelaffaire avatar image maximelaffaire brendan commented ·

Well ithe second call is throwing an error indeed, but it seems normal to me since the first call worked. My first problem was that 2 account were in each other friends list (which I get with Client/GetFriendsList) and it was impossible to unfriend them

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.