question

terrypapamarkou avatar image
terrypapamarkou asked

Debugging login issues

Hoping someone can help debug some issues we are having with some players.

After doing an initial login to playfab using the player's device ID, we create an entity key with this

EntityKey = new EntityKey
{
    Id = loginResult.EntityToken.Entity.Id,
    Type = loginResult.EntityToken.Entity.Type
}; 

and then check if they have a new enough version and if they do we log them in via a cloudscript function.

PlayFabClientAPI.GetTitleData(new GetTitleDataRequest { Keys = new List<string> { _CurrentVersionKey } }, result =>
{
    if (GameVersion >= float.Parse(result.Data[_CurrentVersionKey]))
    {
      
        LoginCloudScript();
    }
    else
    {
        Debug.Log("Update Required");
        UIPanelManager.Instance.ShowGenericPopup("UPDATE REQUIRED", "PLEASE DOWNLOAD THE LATEST VERSION.");
        
    }
}, error =>
{
    Debug.Log("Playfab error");
});

The LoginCloudScript() function checks their internal player data (title) and if it doesn't find what it needs it creates default values for a bunch of objects.

We are starting to see quite a few new players (about 10%) that don't have this default data and therefore cannot load our game. It seems like the LoginCloudScript() is never being run for them.

I'm looking through the Data Explorer for some of these players but nothing is jumping out as being obviously wrong. The events include

player_logged_in

player_added_title

entity_logged_in

player_linked_account

player_created

entity_created

{
    "PlayFabEnvironment": {
        "Application": "mainserver",
        "Vertical": "master",
        "Commit": "996e2a8",
        "Cloud": "main"
    },
    "EventNamespace": "com.playfab",
    "EntityType": "title_player_account",
    "SourceType": "BackEnd",
    "Timestamp": "2021-12-14T11:19:32.2840644Z",
    "EventName": "entity_created",
    "EntityId": "491CD281F9CFC601",
    "EventId": "072c096c044c43ca992f04eec6d678f2",
    "Source": "PlayFab",
    "EntityLineage": {
        "TitleId": "11D0D",
        "MasterPlayerAccountId": "6A1E83686E2D315F",
        "TitlePlayerAccountId": "491CD281F9CFC601",
        "NamespaceId": "7345EB9BFD68BBC"
    },
    "EntityChain": "title_player_account!7345EB9BFD68BBC/11D0D/6A1E83686E2D315F/491CD281F9CFC601/"
}

another entity_created straight after

{
    "Timestamp": "2021-12-14T11:19:32.7962093Z",
    "EntityLineage": {
        "master_player_account": "6A1E83686E2D315F",
        "title_player_account": "491CD281F9CFC601",
        "namespace": "7345EB9BFD68BBC",
        "title": "11D0D"
    },
    "PayloadContentType": "Json",
    "SchemaVersion": "2.0.1",
    "Originator": {
        "Type": "service",
        "Id": "playfab"
    },
    "OriginInfo": {},
    "FullName": {
        "Namespace": "playfab.entity",
        "Name": "entity_created"
    },
    "Payload": {},
    "Id": "c104f103a0f7456cab2f763057d13478",
    "Entity": {
        "Type": "title_player_account",
        "Id": "491CD281F9CFC601"
    }
}


Then it's basically just client_focus_change events. I can't see any events where it has tried and failed to run the LoginCloudScript() function which makes me think that the call to that function inside the GetTitleData call is not being called for some players.

Regarding the version check in the GetTitleData, we are still in beta and haven't changed the version number in a long time so there is no reason why that should be preventing the login function from being called.

Like I said, I don't think this function is being called but I will include a cut back version here anyway.

 private void LoginCloudScript()
    {

        var deviceId = SystemInfo.deviceUniqueIdentifier;

        ExecuteCloudScriptRequest request = new ExecuteCloudScriptRequest
        {
            FunctionName = "Login",
            RevisionSelection = RevisionOption,
            GeneratePlayStreamEvent = LogCloudScript,
            FunctionParameter = new Dictionary<string, object>
            {
                { "EntityId", EntityKey.Id },
                { "DeviceId", deviceId },
                { "AppVersion", GameVersion }
            }
        };
        PlayFabClientAPI.ExecuteCloudScript(request, result =>
        {
          
            if (result.Error == null)
            {
                var res = JsonReader.Deserialize<CloudResponse>(result.FunctionResult.ToString());
                if (res.Result == "success")
                {

                    //great
                    return;
                }
                else
                {
                    Debug.Log("Playfab error");
                   
                    return;
                }
            }
            Debug.Log("Playfab error " + result.Error.Message);
           
        }, error =>
        {
            OnLoginFailure(error);
        });
    }
    

Can anyone suggest some things I can check to try to resolve this issue?

Thanks in advance

entities
10 |1200

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

1 Answer

·
terrypapamarkou avatar image
terrypapamarkou answered

OK I believe the issue was this

float.Parse(result.Data[_CurrentVersionKey])

It was failing on devices set to certain languages.

Going to try this instead.

float.Parse(result.Data[_CurrentVersionKey],System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture)
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.