Using Visual Studio 2017, I created a Function App with a Generic WebHook:
public static class FunctionWebHook
{
[FunctionName("FunctionWebHook")]
public static async Task<object> Run([HttpTrigger(WebHookType = "genericJson")]HttpRequestMessage request, TraceWriter log)
{
log.Info($"Webhook was triggered!");
string jsonContent = await request.Content.ReadAsStringAsync();
log.Info(jsonContent);
return request.CreateResponse(HttpStatusCode.NoContent);
}
}
The code is little more than the default template. I deployed this to my Azure account and tried to invoke it. I used the 'Get function url' link on the portal to get the correct URL, this included both the code and clientId parameters. When I try to POST JSON to the function (with content type set to application/json) I receive a 400 Bad Request:
{"Message":"The 'code' query parameter provided in the HTTP request did not match the expected value."}
I've check the code parameter and it is correct. I've also re-created the Function App several times, however I continue to receive the error. When I invoke the function using the Portal's Run command it executes correctly.
Has anyone come across this issue before?