question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

req.Content.ReadAs<T> fails to deserialize when using WebHook SDK auth

See original GitHub issue

Use 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:closed
  • Created 8 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
mathewccommented, Mar 23, 2016

Also, I had Pizza for dinner. @paulbatum @fabiocav

1reaction
mathewccommented, Mar 23, 2016

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found