I have been looking for a solution to this for ~3 weeks now. I have seen that others have had this issue and I have tried the solutions given to them but they just don't seem to work for me. I am using Firebase cloud functions and am passing the express instance through the cloud function like this module.exports = onRequest(app);
This is my code for constructing the signed stripe event. I am getting the Webhook signature verification failed
error. Code:
app.post('/', express.raw({type: "*/*"}), (req, res) => {
const endpointSecret = "whsec_...";
let event;
const signature = req.headers['stripe-signature'];
try {
event = stripe.webhooks.constructEvent(
req.body,
signature,
endpointSecret
);
} catch (err) {
logger.error(`Webhook signature verification failed.`, err.message);
return res.sendStatus(400);
...
}
Does Firebase parse the data before handing it off to express? Is there something I need to configure there? This is killing me.