I'm currently executing an Azure function from the legacy cloudscript. The Azure function is correctly capturing an error and returns a BadRequestObjectResult along with a message (I'd prefer it to be be stringified JSON object). Below is the response I receive from the cloudscript invocation:
{ "Level": "Info", "Message": "Exception: {\"code\":400,\"status\":\"BadRequest\",\"error\":\"CloudScriptAzureFunctionsHTTPRequestError\",\"errorCode\":1473,\"errorMessage\":\"Invocation of cloud script function StoreTransaction failed\"}", "Data": null }
As you can see there is no additional data returned. Is there a way to pass the error data back?
For clarification:
Cloudscript Invocation:
function executeAzureFunction(functionName, functionParameter)
{
let url = `https://${script.titleId}.playfabapi.com/Authentication/GetEntityToken`;let method = "POST";let headers = {
"X-SecretKey": PLAYFAB_SECRET_KEY
};
let contentType = "application/json";
let contentBody = {
Entity: {
Id: script.titleId,Type: "title"}
};
let response = JSON.parse(http.request(url, method, JSON.stringify(contentBody), contentType, headers));
url = `https://${script.titleId}.playfabapi.com/CloudScript/ExecuteFunction`;
headers = {
"X-EntityToken": response.data.EntityToken
};
contentBody = {
FunctionName: functionName,FunctionParameter: functionParameter
};
response = JSON.parse(http.request(url, method, JSON.stringify(contentBody), contentType, headers));
return response;
Azure Function:
[FunctionName("StoreTransaction")] public static async Task<IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log) {
//Found something wrong, return a BadRequestObjectResult
return new BadRequestObjectResult("something went wrong");
}