req.Content.ReadAs<T> fails to deserialize when using WebHook SDK auth
See original GitHub issueUse a WebHook with this code:
using System;
using System.Net;
using System.Threading.Tasks;
public static async Task<object> Run(HttpRequestMessage req, TraceWriter log)
{
var foo = await req.Content.ReadAsAsync<Foo>();
return req.CreateResponse(HttpStatusCode.OK, $"foo is null: {foo==null}");
}
class Foo {}
If I pass the request body {}
from our Functions test UI, it works fine. i.e. foo is not null.
But if I try to do the same thing from postman, passing the same body {}
as application/json
, then I end up with foo=null.
If It set the x-functions-key
header to the master key in postman (to do the same as Function Portal, instead of using code query string), then it works! So I suspect some issue from the WebHook SDK auth messing up the state of the request.
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Event hook verification failed - Could not deserialize ...
I am testing out the event hook feature in Okta, but when I try to verify the endpoint, the message came out to...
Read more >Deserialization error from RESTful API
The problem is trying to get a list of EmailLog objects directly because they are enclosed within the "items" element of your json...
Read more >The JSON request was too large to be deserialized.
During a webhook request to my Shopify app's "OrderCreated" action, ASP.NET threw a "System.InvalidOperationException" exception, saying that "The JSON request ...
Read more >Meraki webhook fails when using basic auth
Solved: I'm attempting to send Meraki event data via Webhooks to a rest endpoint that requires authentication. There does not appear to be...
Read more >"Can not deserialize instance..." error when trying to run ...
I'm trying to run a POST create organization call through a Zapier action step, as part of a new customer support setup flow...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Also, I had Pizza for dinner. @paulbatum @fabiocav
Yeah, I’d like to know the root cause too - to be sure it isn’t something we’re doing wrong. I think it only happens when going through the WebHook receiver pipeline because those libraries are also reading the content, so there are multiple readers.
It’d be interesting to try to reproduce this issue using the WebHook receiver libraries outside of functions, to truly find out if it’s something we’re doing wrong, or whether Henrik has a bug.