Errors when handling requests from patreon

Im getting an error when ever Patreon sends a request to my system,

1|Cluster  | TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Object
1|Cluster  |     at new NodeError (node:internal/errors:372:5)
1|Cluster  |     at Hmac.update (node:internal/crypto/hash:105:11)
1|Cluster  |     at /root/dev/events/client/ready.js:126:58
1|Cluster  |     at Layer.handle [as handle_request] (/root/dev/node_modules/express/lib/router/layer.js:95:5)
1|Cluster  |     at next (/root/dev/node_modules/express/lib/router/route.js:137:13)
1|Cluster  |     at Route.dispatch (/root/dev/node_modules/express/lib/router/route.js:112:3)
1|Cluster  |     at Layer.handle [as handle_request] (/root/dev/node_modules/express/lib/router/layer.js:95:5)
1|Cluster  |     at /root/dev/node_modules/express/lib/router/index.js:281:22
1|Cluster  |     at Function.process_params (/root/dev/node_modules/express/lib/router/index.js:341:12)
1|Cluster  |     at next (/root/dev/node_modules/express/lib/router/index.js:275:10) {
1|Cluster  |   code: 'ERR_INVALID_ARG_TYPE'
1|Cluster  | }

Here is the line of code which is throwing the error:

      let hash = crypto.createHmac("md5", webhookSecret).update(request.body).digest("hex");

Im a bit confused on what to do since it use to work perfectly fine…

Any help would be greatly appreciated!

This is likely a local issue since there hasnt been a change to the way that webhooks operate.

Yeah it was, Thanks for the help!

1 Like