question

WosiMan-0009 avatar image
0 Votes"
WosiMan-0009 asked ·

Http Webhook Outputs does not have body content, only headers

Hi,

I set up the http webhook action in my logic app.
it posts the callback url to my Azure function with http trigger,
that queues a message to my other Azure function with queue trigger so I can do long running job

at the end, the queue triggered Azure function post back to the callbackUrl
the post clearly has json payload (which I logged with app insight along with response status code OK)
but in Logic Apps Http Webhook, it only shows the headers not anything in the body
it even show a special header "pubCount" I put there in the post request but nothing from the posted body content.

it's like this:
{
"headers": {
"Transfer-Encoding": "chunked",
"Host": "prod-125.westus.logic.azure.com",
"pubCount": "15",
"Request-Context": "appId=cid-v1:35980825-543f-479e-abe9-6effd9f72c59",
"Request-Id": "|0f02aa3bd52fcf4f98ec8b1249ae3533.01019e4b18689e48.",
"traceparent": "00-0f02aa3bd52fcf4f98ec8b1249ae3533-01019e4b18689e48-00",
"Content-Type": "application/json; charset=utf-8",
"Content-Length": "0"
}
}


Please let me know what I am missing in getting the final action result in the Webhook Outputs body. Thanks.

azure-logic-apps
· 4
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

paste again the Outputs, remove all the quotes

{
headers: {
Transfer-Encoding: chunked,
Host: prod-125.westus.logic.azure.com,
pubCount: 15,
Request-Context: appId=cid-v1:35980825-543f-479e-abe9-6effd9f72c59,
Request-Id: |0f02aa3bd52fcf4f98ec8b1249ae3533.01019e4b18689e48.,
traceparent: 00-0f02aa3bd52fcf4f98ec8b1249ae3533-01019e4b18689e48-00,
Content-Type: application/json; charset=utf-8,
Content-Length: 0
}
}

0 Votes 0 · ·

Based on the headers, it looks like your function is initiating a chunked request. Is this intentional?

If you are trying to return a large payload, it's better to upload the result into blob storage and share just the path with the logic app, which you can fetch by using the Get blob content using path action.


0 Votes 0 · ·
WosiMan-0009 avatar image WosiMan-0009 PramodValavala-MSFT ·

the code and payload are really simple

client.DefaultRequestHeaders.Add("pubCount", "15");
var response = await client.PostAsJsonAsync(callbackUrl, new Result { PubCount = 15 })

0 Votes 0 · ·

Should I file a service request for this type of question.
I thought this is a simple problem.

0 Votes 0 · ·

1 Answer

PramodValavala-MSFT avatar image
0 Votes"
PramodValavala-MSFT answered ·

Based on the discussion in this issue, looks like chunked encoding is the default and hence the behavior that you see.

The solution would be to either set an explicit Content-Length header in your request or to use StringContent which does this for you. For example, I can confirm the following works

await _httpClient.PostAsync(callbackUrl, new StringContent(data, Encoding.UTF8, "application/json"));




· 2 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Pramod,
Thanks for following up with the answer!
I will give it a try and get back with results soon.

0 Votes 0 · ·

yes, it worked. Here is the current Outputs
{
"headers": {
"Host": "prod-125.westus.logic.azure.com",
"Request-Context": "appId=cid-v1:35980825-543f-479e-abe9-6effd9f72c59",
"Request-Id": "|e84435f0bfbb48498824f7b2bbc2ec3e.2c1fff21f302324b.",
"traceparent": "00-e84435f0bfbb48498824f7b2bbc2ec3e-2c1fff21f302324b-00",
"Content-Length": "74",
"Content-Type": "text/plain; charset=utf-8"
},
"body": "{\r\n \"Succeeded\": true,\r\n \"PubCount\": 15,\r\n}"
}

thanks a lot, we can close this question.

0 Votes 0 · ·