Re: "Failed to process webhook: Error: No body was received when processing webhook" when

"Failed to process webhook: Error: No body was received when processing webhook" when migrate to v7

Neli2404
Shopify Partner
13 1 2
Hi everyone! I’m having issues with the webhooks process
I’m trying to migrate my current app template(v5) to v7. When I test, the webhooks always throws this Error (Code 400):

 

"Failed to process webhook: Error: No body was received when processing webhook".

 

But when I generate a new Node template, the webhooks executed just fine with the code 200
I have tried all the following solutions:
  • Read all forums, tried all solutions
  • Copy the exact index.js code from the new template to my app
  • Upgrade all packages to lastest version (shopify-api, shopify-cli, you name it….)
  • Add express.text({type: '*/*'}) to the webhook config route like this Shopify official docs
  • Manually delete all webhooks by POSTMAN, then reinstall the app
  • Try different dev stores, assign to different apps
This is my code snippet on the webhook config routes (Which just the code generated from the new node template):

 

app.post(
  shopify.config.webhooks.path,
  shopify.processWebhooks({ webhookHandlers: GDPRWebhookHandlers })
);

 

I don’t know how I can fix this, since I don’t want to rebuild the app from the new template. If anyone can help me, I would be really appreciated. Thank you.
Replies 3 (3)

Liam
Shopify Staff
2831 311 806

Hi Nam7911,

 

Having looked into this, I think the developer from this Stack Overflow thread was experiencing a similar issue, and adding `express.text({type: '*/*'})` before `shopify.processWebhooks({ webhookHandlers: GDPRWebhookHandlers })` was able to resolve the issue for them.

 

You might also be able to find some insights from this readme on setting up webhooks from our shopify-api-js repo too, that will help with troubleshooting and solving this. 

 

Let me know if this works and if not we can dig into this more,

Liam | Developer Advocate @ 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 Shopify.dev or the Shopify Web Design and Development Blog

Neli2404
Shopify Partner
13 1 2

thank you but I've tried as I mentioned above

westernY
Shopify Partner
8 0 1

Is aboved advice useful ?