question

Dimeland avatar image
Dimeland asked

Deleted user can still login

I found this odd behaviour that is probably a bug.

Here are the steps that produce it for me:

- Create a user account (I created it through client API RegisterPlayFabUser);

- Have it scheduled to be deleted through a scheduled task with "Delete Player" action;

- Login with the same credentials through client api LoginWithEmailAddress;

Expected behaviour would be to not let the user login.

Actual behaviour is a new account is created with no data through the client api login call.

Notes:

The master account player is indeed deleted (not pending) and does not show up anymore in the game manager dashboard.

After the unexpected login, the new user pops up in the game manager.

In the documentation of LoginWithEmailAddress it clearly states it should not create new accounts.

If I delete the master account through the game manager dashboard, the issue does not happen.

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.

Dimeland avatar image Dimeland commented ·

So I guess the scheduled task action is to delete the title player and not the master player...

So I am left with two questions:

- Where can i see the master player accounts (the ones with no titles associated) in the game manager?

- What other way do I have to delete all the master player accounts in a segment? I already tried to run an azure function to call DeleteMasterPlayerAccount but it very often times out as scheduled task only has 1 sec to process. This despite my script only getting the context and calling that api function...

0 Likes 0 ·
Xiao Zha avatar image
Xiao Zha answered

>> Where can i see the master player accounts (the ones with no titles associated) in the game manager?

You cannot see master player accounts with no titles associated in the Game Manager, as the Game Manager is Title based.

>> What other way do I have to delete all the master player accounts in a segment? I already tried to run an azure function to call DeleteMasterPlayerAccount but it very often times out as scheduled task only has 1 sec to process. This despite my script only getting the context and calling that api function...

Where you get the timeout error message? And is there any error message appeared in your Azure Function console? In addition, could you share the Azure Function code for us to research?

3 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.

Dimeland avatar image Dimeland commented ·

Thanks for the answer!

In the meantime I solved the issue by converting my function into a queue triggered function.

But here is the code that timed out as a HTTP trigger:

var context = JsonConvert.DeserializeObject<PlayerPlayStreamFunctionExecutionContext<dynamic>>(myQueueItem);


var apiSettings = new PlayFab.PlayFabApiSettings()
{
    DeveloperSecretKey = Environment.GetEnvironmentVariable("PLAYFAB_DEV_SECRET_KEY", EnvironmentVariableTarget.Process),
    TitleId = Environment.GetEnvironmentVariable("TITLE_ID", EnvironmentVariableTarget.Process)
};
var adminAPI = PlayFab.PlayFabAdminInstanceAPI(apiSettings);

adminAPI.DeleteMasterPlayerAccountAsync(new DeleteMasterPlayerAccountRequest
{
    PlayFabId = context.PlayerProfile.PlayerId
});

I got the timeout error in playstream on the event details.

By the way, what is the limit for the queue triggered azure function in a scheduled task?

I find the information present in https://learn.microsoft.com/en-us/gaming/playfab/features/automation/cloudscript-af/quickstart contradictory, as it states queue functions have a 1sec limit...

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha Dimeland commented ·

Since you use the “myQueueItem” which indicates your code is a Queue Trigger Function not an Http Trigger Function, you may check your code again. And once AzureFunction is called, if your code has no errors, it will definitely finish executing, no matter whether PlayFab service will time out or not. In addition, using Queue Trigger to handle situation which takes long time is also what we recommended, because Queue Trigger will send the request to the queue storage, and then Azure Function will dequeue and process the requests in order and you will not receive the function result, so there will be no timeout issues on the PlayFab side.

0 Likes 0 ·
Dimeland avatar image Dimeland Xiao Zha commented ·

Yes, the code was already converted to queue trigger. But before was a Http trigger (using http req to get the context, naturally) and this simple function would not complete under 1 sec.

Now I am confused... Are you saying that despite timing out the http triggered function would still complete and effectively deleting the account? Because that did not happen in my case. And if that is really the case, what is the benefit of converting to a queue function? It ends up being the same, as it would still complete and I would not get a response anyways.

0 Likes 0 ·
Xiao Zha avatar image
Xiao Zha answered

If you use http req to get the context, there should be no problem for your code. And since I cannot reproduce your issue, here is my working test code, you can have a look:

public static class Function1
    {
        [FunctionName("DeleteMasterPlayerAccount")]
        public static async Task Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
            ILogger log)
        {
            PlayerPlayStreamFunctionExecutionContext<dynamic> context = JsonConvert.DeserializeObject<PlayerPlayStreamFunctionExecutionContext<dynamic>>(await req.ReadAsStringAsync());


            var apiSettings = new PlayFabApiSettings
             {
                 TitleId = Environment.GetEnvironmentVariable("PLAYFAB_TITLE_ID", EnvironmentVariableTarget.Process),
                 DeveloperSecretKey = Environment.GetEnvironmentVariable("PLAYFAB_DEV_SECRET_KEY", EnvironmentVariableTarget.Process)
             };




            
            PlayFabAdminInstanceAPI api = new PlayFabAdminInstanceAPI(apiSettings);


            var result = await api.DeleteMasterPlayerAccountAsync(new DeleteMasterPlayerAccountRequest
            {
                PlayFabId = context.PlayerProfile.PlayerId,
            });


         }
     }

In addition, to avoid getting timeout error in PlayFab side, it is recommended to use Queue Trigger Function.

10 |1200

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

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.