I have some difficulties in operating on player data in an azure function.
Here is a simple exemple:
public static class ServerAccountManagement { [FunctionName("CreateServerAccount")] public static async Task<IActionResult> RunCreateServerAccount( [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequestMessage req, ILogger log) { var context = await FunctionContext<dynamic>.Create(req); //Check if that player already has an account log.LogInformation($"Server account call made by: {context.CurrentPlayerId}|{context.CallerEntityProfile.DisplayName}|{context.CallerEntityProfile.EntityChain}"); var request = new PlayFab.AdminModels.GetUserDataRequest { PlayFabId = context.CurrentPlayerId, Keys = new List<string> { "owned_game_server" } }; var serverApi = new PlayFab.PlayFabAdminInstanceAPI(context.ApiSettings, context.AuthenticationContext); var result = await serverApi.GetUserReadOnlyDataAsync(request); log.LogInformation(result.Error.ErrorMessage); return new OkObjectResult(""); } }
If i call this via either the game manager on a player or from the PlayFab sdk, the user data request fails with:
"
master_player_account 300923418170631384 not found in namespace 3268C20C0AF90B24"
while the initial information logs:
"
42D184124A824D8||title_player_account!3268C20C0AF90B24/44B9F/28B30D653E05AC40/42D184124A824D8/"
which also seems to be missing the display name.
I have been following the github samples but i am not quite sure if i am using the correct FunctionContext or data types.