I've been trying to use cloud functions in playfab and for some reason it doesn't recognize the parameters I pass from unity's sdk. I tried both azure and digitalOcean cloud functions. for the FunctionParameter field, ive tried dictionaries, objects, etc. There is very little info online that isnt outdated, so i was hoping cloud functions still work?
Ive attached the playfab function above (with a valid URL, just whited out)
Here is the azure function code (basically default):
#r "Newtonsoft.Json" using System.Net; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Primitives; using Newtonsoft.Json; public static async Task<IActionResult> Run(HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); string name = req.Query["name"]; string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); dynamic data = JsonConvert.DeserializeObject(requestBody); name = name ?? data?.name; string responseMessage = string.IsNullOrEmpty(name) ? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response." : $"Hello, {name}. This HTTP triggered function executed successfully."; return new OkObjectResult(responseMessage); }
And here is my unity call:
PlayFabCloudScriptAPI.ExecuteFunction( new ExecuteFunctionRequest { FunctionName = "AzureTest", GeneratePlayStreamEvent=true, FunctionParameter = new { name = "chicken" } }, result => { Debug.Log(result.ToJson()); }, err => { Debug.LogError(err.GenerateErrorReport()); } );
The call is successful, but always returns this as if i sent no parameters:
{"Error":null,"ExecutionTimeMilliseconds":627,"FunctionName":"AzureTest","FunctionResult":"This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.","FunctionResultTooLarge":null,"Request":{"CustomTags":null,"Entity":null,"FunctionName":"AzureTest","FunctionParameter":{"name":"pinga"},"GeneratePlayStreamEvent":true,"AuthenticationContext":null},"CustomData":null} UnityEngine.Debug:Log (object)
Ive just started learning cloud functions in playfab so if there is a good way to debug this stuff, Id appreciate info about that as well