#smahs-webhook-signature

1 messages · Page 1 of 1 (latest)

wraith mulch
#

Hey there, yeah the raw body is required as you noted.... I'm not familiar with this set up though so not sure how helpful I'll be. I'll dig around for a moment though and try to familiarize.

#

Actually can you provide your webhook server code for me to take a look at?

desert geyser
#

this is the endpoint logic

wraith mulch
#

How about your Express logic?

desert geyser
#

it's working locally, just not when I deploy it on AWS

wraith mulch
#

Ah okay that's what I was worried about

#

That said, I have run into this issue before locally where the app.use(express.json()) messes with the raw body

#

For instance, in the past I have done something like: app.use((req, res, next) => { if (req.originalUrl === '/webhook') { next(); // Do nothing with the body because I need it in a raw state. } else { express.json()(req, res, next); // ONLY do express.json() if the received request is NOT a WebHook from Stripe. } });

#

It may be worth trying something like that to see if it is actually Express messing with stuff here.