Normally when I try to access a shared group Data that doesn't exist I get an error code: PlayFabErrorCode.NotAuthorized.
But for this specific shared group data with the id:.E73426F63FC7A5CD68F981EEC50CA4B8 I get no error when trying to access it with the unity client GetSharedGroupData(). But normally I have deleted it.
When I look it up with the developer console at: https://developer.playfab.com/
there is one random variable in the dictionary left yet there is no members and non of the other variables that where there when I created the group. When i try to deleted it or remove the last key remaining it tells me error i can't because there is no members.
in this next picture the shared group data has being recreated there are members but at first there are no keys
whether I add keys or not after I delete the shared group data it goes back to picture one:
more info :
azur cloud function used to create the group data:
[FunctionName("acceptChat")] public static async Task<IActionResult> acceptChat( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("C# acceptChat function processed a request."); FunctionExecutionContext<dynamic> context = JsonConvert.DeserializeObject<FunctionExecutionContext<dynamic>>(await req.ReadAsStringAsync()); var args = context.FunctionArgument; var entityProfile = context.CallerEntityProfile; EntityKey masterPlayerAccountEntity = new EntityKey() { Id = entityProfile.Lineage.MasterPlayerAccountId, Type = "master_player_account" }; var dataApi = GetDataAPI(context); //ClassConverter<PlayFab.ProfilesModels.EntityKey, PlayFab.DataModels.EntityKey>.Convert(entityProfile.Entity) var getObjectsResponse = await GetObjects(masterPlayerAccountEntity, dataApi); var getObjectsResult = getObjectsResponse.Result.Objects; List<AskToChatRequest> listChatRequests = null; PlayFabResult<SetObjectsResponse> setResponse = null; AskToChatRequest requestAccepted = null; if (getObjectsResponse.Result.Objects.Count != 0) { var chatRequestObject = getObjectsResponse.Result.Objects["ChatRequests"]; var chatRequests = chatRequestObject.DataObject; listChatRequests = JsonConvert.DeserializeObject<List<AskToChatRequest>>(chatRequests.ToString()); bool foundRequest = false; for (int i = 0; i < listChatRequests.Count; i++) { if (listChatRequests[i].idOfChatAsker == ((string)args.askerId)) { foundRequest = true; listChatRequests[i].state = "accepted"; requestAccepted = listChatRequests[i]; break; } } if (foundRequest) { var serverApi = GetServerAPI(context); requestAccepted.groupDataId = requestAccepted.idOfChatAsker + entityProfile.Lineage.MasterPlayerAccountId; requestAccepted.idOfRequestReceiver = entityProfile.Lineage.MasterPlayerAccountId; var requestCreat = new PlayFab.ServerModels.CreateSharedGroupRequest() { SharedGroupId = requestAccepted.groupDataId }; var resultCreat = await serverApi.CreateSharedGroupAsync(requestCreat); List<String> MemebersIds = new List<string>(); MemebersIds.Add(requestAccepted.idOfChatAsker); MemebersIds.Add(entityProfile.Lineage.MasterPlayerAccountId); var requestAddMember = new PlayFab.ServerModels.AddSharedGroupMembersRequest() { PlayFabIds = MemebersIds, SharedGroupId = requestAccepted.groupDataId }; var resultAddMember = await serverApi.AddSharedGroupMembersAsync(requestAddMember); setResponse = await SetObjects(masterPlayerAccountEntity, dataApi, "ChatRequests", listChatRequests); } } return new OkObjectResult(new { getResult = requestAccepted, }); }
azur cloud function used to delete the group data:
[FunctionName("leaveChat")] public static async Task<IActionResult> leaveChat( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("C# leaveChat function processed a request."); FunctionExecutionContext<dynamic> context = JsonConvert.DeserializeObject<FunctionExecutionContext<dynamic>>(await req.ReadAsStringAsync()); var args = context.FunctionArgument; var entityProfile = context.CallerEntityProfile; var serverApi = GetServerAPI(context); var requestDeleteSharedData = new PlayFab.ServerModels.DeleteSharedGroupRequest() { SharedGroupId = ((string)args.groupDataId) }; var resultDeleteSharedData = await serverApi.DeleteSharedGroupAsync(requestDeleteSharedData); return new OkObjectResult(new { getResult = resultDeleteSharedData }); }
this next script is the unity client function used to get data from the shared group data here i get "found no data" printed in the consol when attempting to access the group data that doesn't exist E73426F63FC7A5CD68F981EEC50CA4B8 but for other group data that doesn't exist i get "failed to get message: " + error"
async Task<GetSharedGroupDataResult> GetSharedGroupDataGame(string fullDataName) { Debug.Log("GetSharedGroupDataGame() called"); TaskCompletionSource<bool> functionOperating = new TaskCompletionSource<bool>(); GetSharedGroupDataResult sharedDataFound = null; int contextCalled = contextId; var request = new GetSharedGroupDataRequest() { SharedGroupId = chatGroupIn, Keys = new List<string> { (fullDataName) }, GetMembers = false }; PlayFabClientAPI.GetSharedGroupData(request, (GetSharedGroupDataResult result) => { if (result.Data != null && result.Data.ContainsKey(fullDataName) && result.Data[fullDataName] != null) { sharedDataFound = result; Debug.Log("found data"); } Debug.Log("found no data"); functionOperating.SetResult(true); }, (PlayFabError error) => { if (contextCalled == contextId && error.Error == PlayFabErrorCode.NotAuthorized) { AutoLeaveChat(); } Debug.Log("failed to get message: " + error); functionOperating.SetResult(true); }); await functionOperating.Task; return sharedDataFound; }
Thanks for any help.