Hi all!
I'm trying to implement a call to an Azure function in a company project to work with PlayFab.
I'm studying the PlayFab CloudScript Context documentation: https://learn.microsoft.com/en-us/gaming/playfab/features/automation/cloudscript-af/quickstart https://learn.microsoft.com/en-gb/gaming/playfab/features/automation/cloudscript-af/cloudscript-af-context
Added this class to the project: https://github.com/PlayFab/PlayFab-Samples/blob/master/Samples/CSharp/AzureFunctions/CS2AFHelperClasses.cs
And I ran into a problem. When this code is executed, the context variable is always null.
FunctionExecutionContext<dynamic> context = JsonConvert.DeserializeObject<FunctionExecutionContext<dynamic>>(await req.ReadAsStringAsync());
I tried other options:
1) PlayerPlayStreamFunctionExecutionContext<dynamic> context = JsonConvert.DeserializeObject<PlayerPlayStreamFunctionExecutionContext<dynamic>>(await req.ReadAsStringAsync());
2) string json = await req.ReadAsStringAsync();
FunctionExecutionContext<dynamic> context = JsonConvert.DeserializeObject<FunctionExecutionContext<dynamic>>(json);
The result is the same.
I was looking for answers on your forum. I tested everything I could find, but the context variable always returns null. https://community.playfab.com/questions/38743/how-to-get-functionexecutioncontext-inside-queue-f.html https://community.playfab.com/questions/58784/azure-function-functionexecutioncontext.html https://community.playfab.com/questions/84412/azure-functions-the-name-functioncontext-does-not.html https://community.playfab.com/questions/45899/azure-functions-context-return-null-scheduled-task.html
https://www.youtube.com/watch?v=ur42SwGkfy4
Why doesn't this code work? How should I fix it to get the context?