Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
I've running into an issue with an app built using the Shopify CLI boilerplate.
I am subscribing to few webhook topics, including `ORDERS_UPDATED`. For most orders the webook runs fine and responds back to Shopify with a 200.
However for some orders it is bumping into a problem saying that the payload was too big and rejected by the server. Error appear to be triggered by the package `body-parser`:
```
PayloadTooLargeError: request entity too large
dfw [info] at readStream (/app/node_modules/raw-body/index.js:156:17)
```
I've tried to adjust settings for that module as listed below but as soon as I do that the server appears go get no payload whatsoever and therefore refuses the webhook due to missing data.
```
Just to answer my own question, solution to include another middleware in the route declaration for the webhooks.
So if you've started with the CLI boilerplate, that would be:
app.post(
shopify.config.webhooks.path,
express.text({ type: '*/*', limit: '3MB' }),
shopify.processWebhooks({ webhookHandlers: GDPRWebhookHandlers })
);