I feel like an idiot, I know I'm doing something stupid, but I need someone to point it out for me. As the title suggests, my azure function is failing specifically on an attempt to deserialize the argument I pass in so I can use it.
// this is the request that is sent from client to cloudscript public class CompleteLogin_Request { public int ClientVersion = -1; public int Language = -1; } // this is a portion of the call from client to cloud { ... PlayFabCloudScriptAPI.ExecuteFunction( new ExecuteFunctionRequest() { Entity = new PlayFab.CloudScriptModels.EntityKey() { Id = PlayFabSettings.staticPlayer.EntityId, Type = PlayFabSettings.staticPlayer.EntityType }, FunctionName = "CompleteLogin", FunctionParameter = new Dictionary<string, object>() { { "Request", PlayFabSimpleJson.SerializeObject( loginRequest ) } }, GeneratePlayStreamEvent = true }, ... } // this is my azure function with the same class definition for the request { FunctionExecutionContext<dynamic> functionContext = JsonConvert.DeserializeObject<FunctionExecutionContext<dynamic>>(await req.ReadAsStringAsync()); string currentPlayerId = functionContext.CallerEntityProfile.Lineage.MasterPlayerAccountId; dynamic args = functionContext.FunctionArgument; CompleteLogin_Result clientReturn = new CompleteLogin_Result() { ServerTime = new DateTime() }; if( args != null && args[ "Request" ] != null ) { // THIS LINE CRASHES THE FUNCTION CompleteLogin_Request request = JsonConvert.DeserializeObject<CompleteLogin_Request>(args["Request"]); } }
I'm not sure why, but trying to deserialize the "Request" key from the args dictionary causes problems. It's so silly, I've done this a million times, I can't tell what's wrong.
Any ideas?
Thanks!!
-Matt