0

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.

Leo
  • 9
  • 5
  • Did you read into this ? https://stackoverflow.com/questions/53899365/stripe-error-no-signatures-found-matching-the-expected-signature-for-payload note that parsing is also an issue known for Express : https://github.com/stripe/stripe-node/issues/341 – Lucky2501 Sep 02 '23 at 21:29

0 Answers0