Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
I created a variety of webhooks via the API (they exist and are posting back to my server as well for the proper event triggers).
The issue however is that the body of the POST that its the server is blank. Only thing I'm getting out of the request is some HTTP Header info, which includes (below).
Any ideas what I might be doing wrong?
Thanks,
Jason
Array ( [Content-type] => application/json [Content-Type] => application/json [X-Shopify-Topic] => carts/create [X-Shopify-Shop-Domain] => abc123.myshopify.com [Accept-Encoding] => gzip;q=1.0,deflate;q=0.6,identity;q=0.3 [Accept] => */* [User-Agent] => Ruby [Connection] => close [Host] => dev.xxxxxxxxx.com [Content-Length] => 331 )
That's pretty odd. Is the content 331 spaces or something?
Chris | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Figured it out... for future reference:
$rawData = file_get_contents('php://input');
$data = json_decode($rawData);
HI, I am having the same issue. I am using nodejs and expressjd and in the req.body i get nothing. What did you do to solve this problem?
Can you be a little more specific? If your content length isn't 0, then it's probably somewhere on your side of the code - have you made sure the content type is correct, have validated the HMAC and are accessing the body correctly - usually by wiring up body-parser via
app.use(express.bodyParser())
Have you tested your webhook handler in isolation?
Best wishes!
Awesome!
Chris | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog