Azure API Management is with a response "System.NullReferenceException: Object reference not set to an instance of an object."
MyFunction.Run(HttpRequest req, ILogger log) in MyFunction.cs:line 61
method signature
public async Task Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req, ILogger log)
Sorry everybody, I newer in Azure APIM!
When I send JSON below in request body to c# azure function API, everything works as well!!
{
"Id":40,
"status":"Doing",
"startedDateTime":"2019-10-17T17:50:44.1314885Z"
}
But when I sending it thru the Azure API Management to serverless azure function API Microservice, I'm getting the error message "Object reference not set to an instance of an object."
My Azure function has only APIM Key into headers and no more things; I just created APIM consumption for use as an endpoint, I have only CORS policy and trying to use for a test, but I got the same problem with
<policies>
<inbound>
<base />
<choose>
<when condition="@(context.Request.Body != null)">
<set-body template="liquid">
<value>@(context.Request.Body.As<JObject>(preserveContent: true).Value<string>())</value>
</set-body>
</when>
</choose>
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
</policies>
Someone can help me? What would be the same solution?