What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Webhook requests exceed max size

Webhook requests exceed max size

Jeebus
New Member
4 0 0

We have a plugin with Shopify and create webhooks with customers. One of our customers occasionally sends us order update (fulfillment) requests that exceed our current max request size of 100KB (the Play default). The request content is being truncated, which causes HMAC to fail, which causes us to kick back a 401, which in turn gets us into trouble with Shopify. So we are trying to figure out a good solution.

Is there a cap on the size of requests Shopify could potentially send us so that we could adjust our max request size accordingly? There is no point in us increasing our limit if we still get even bigger requests. Is there a reason a customer might send a 100KB order fulfillment webhook request? Are images or other such data being included? If so, is there a setting we could request our customer change to ensure we don't get the "excess" data? Is there a proper status code we could return that would not get us in trouble with Shopify when such a scenario did occur?

Any advice you could give on this matter would be greatly appreciated.

-GBS

Replies 7 (7)

Chris_Saunders
Shopify Staff
591 0 53

Some message bodies from Shopify can be upwards of a megabyte depending on the customer/order/etc. Can you configure Play to accept requests that large?

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

Jeebus
New Member
4 0 0

I suppose we could, but how "upwards" are we talking here? 1.5MB? 2MB? And what exactly is taking up all that space? Are there maybe some fields we might want to filter out when creating the webhooks?

HunkyBill
Shopify Partner
4853 60 568

That would be cool. Unusual but cool nonetheless. User definable Webhook subscriptions. Not holding my breath on something like that but it sure would be nice. Subscriber signs up to the Publisher's offerings and cherry picks what they really want in the sundae.

 

 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com

Jeebus
New Member
4 0 0

@HunkyBill, not sure what exactly you mean. Is that not what fields property is for at http://docs.shopify.com/api/webhook ? Or maybe I have misunderstood how that works.

HunkyBill
Shopify Partner
4853 60 568

You can ask for fields on a webhook.. which is pretty mickey mouse, all things considered, but that has nothing to do with the payload you receive. It is merely a decoration on the data returned about a Webhook, not the data the Webhook sends to your endpoint. 

Speaking of misunderstanding, what is Play? I thought that was nothing but the Android store for Apps. How is it an endpoint for anything?

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com

Jeebus
New Member
4 0 0

Chris_Saunders
Shopify Staff
591 0 53

It all depends on what was being sent. There's lots of additional data that is sent with a request (all a products variants, images, etc.) that can result in some pretty large API requests. It would all depend on how your clients or their customers are using Shopify. For example you could have a shop acting as a wholesaler and customers making massive orders. Orders with thousands of items could result in some pretty large requests.

Our API currently doesn't support any kind of gzip compression, which could result in some savings because of all the duplication (keys, etc.) if we added it.

If you can figure out what fields you need, you could update your webhook subscriptions to only the fields you need. Also, until you can figure that out, increasing your permitted request payloads is probably the easiest.

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