#Crawl

1 messages · Page 1 of 1 (latest)

tawdry mossBOT
marble vessel
#

Hello! Can you provide more details? What's the specific error you're seeing?

strong cobalt
#

⚠️ Webhook signature verification failed. No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?

Code :

    let signature = req.headers['stripe-signature'];
    let body = req.rawBody.toString('utf8'); // Convert raw body to utf8 string

    if (endpointSecret) {
      try {
        event = stripe.webhooks.constructEvent(body, signature, endpointSecret);
      } catch (err) {
        console.log(`⚠️  Webhook signature verification failed.`, err.message);
        return res.sendStatus(400);
      }
    }```
#

On local when I trigger events it's working

marble vessel
#

This is very likely the problem: let body = req.rawBody.toString('utf8');

#

Where is rawBody coming from?

strong cobalt
#

but when deploying and trying on test server it's not working

While I setup my webhook endopoint on the stripe dashboard

#

rawBody come from

  express.json({
    verify: (req, res, buffer) => (req['rawBody'] = buffer),
  })
);```
#

but this is working

#

I think I got the env var wrong or I'm missing something

#

Usually I add to stripe listen and forward on the path to my localhost

tawdry mossBOT
strong cobalt
#

maybe the key need to be changed too ?

marble vessel
#

That could be. Are you using the webhook signing secret from your Dashboard for that specific Webhook Endpoint?

strong cobalt
#

On local I'm using

STRIPE_ENDPOINT=whsec_5c.......

#

coming from the forward

#

but I didnt do it for the deployed server, thinking that the dashboard setup would be enough

grim hedge
#

Hi, stepping in and catching up

#

Yeap, I'd want to use the webhook secret key from the Dashboard. Can you try that?

strong cobalt
#

where can I find it ?

#

is it Publishable key ?

grim hedge
strong cobalt
#

oooh okok

#

I wasnt aware of that