Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Subscription Notification Has Blank Body

ANSWERED

I've set up a subscription, tested my endpoint and all is well. However when I receive a notification of an update to my endpoint the body of the request is blank. I have set the subscription to json body and have also tested with json file as the data type and I still receive no content in the notification other than the header. 

 

I'm responding with 204 in roughly 300ms each time.

 

Any idea what could be causing a blank notification body?

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Thanks Samurai Dev. I solved this yesterday as well - I think it was a similar issue. 

 

For future reference for anyone else remember that when receiving a post in express (nodejs) you need to parse the body if it is in json before you can access it.

View best answer in original post

Best Answer
0 Votes
6 REPLIES 6

Having this problem at the moment as well. $_POST, $_GET and $_FILES are all empty and I have my subscriber set to JSON Body. I get notifications, and the "subscriber stats" page shows that the "payload" for each of the requests is atleast 100 bytes, suggesting that there's SOMETHING there, but I can't find anything.

Best Answer
0 Votes

Have you tried logging the header to see if that's correct? I get the header I'm expecting but the body is missing still - the header could easily account for 100 bytes...

Best Answer
0 Votes

The header seems to be fine; the reported size on the subscriber details page varies but the header stays the same size, suggesting that it's describing the body content, which for us is blank.

Best Answer
0 Votes

I found out how to get the body, though I'm using PHP so it may or may not apply to you:

 

$contents = @file_get_contents('php://input');

 

$_POST, $_GET, $_FILES and $_REQUEST were all blank, but the above had what I was looking for. json_decode'd it to get an array of update objects.

Best Answer

Thanks Samurai Dev. I solved this yesterday as well - I think it was a similar issue. 

 

For future reference for anyone else remember that when receiving a post in express (nodejs) you need to parse the body if it is in json before you can access it.

Best Answer
0 Votes

Thanks so much for this. I spend hours looking for the data....

Best Answer
0 Votes