#Sachin_

1 messages Β· Page 1 of 1 (latest)

odd lindenBOT
quiet scaffold
#

πŸ‘‹ Hi there, Happy to help!
Could you please share more details about the error (maybe the requestId if you are using API or screenshot)

dense jewel
#

Hi

dense jewel
#

But my question is for webhook i just need to add url in dashboard?

#

Or i have to do more configuration.

quiet scaffold
#

It depends on the error, you endpoint must be correctly configured for handling HTTPS, because Stripe validates that the connection to your server is secure before sending your webhook data.

#

What TLS version are you using? because Stripe webhooks don’t currently support TLS v1.3

dense jewel
#

I am using local url with ngrok will that work ?

quiet scaffold
#

you need to check if the generated url by ngrok is a valid HTTPS endpoint or not using the website I shared with you above

dense jewel
#

Okay checking...

quiet scaffold
dense jewel
#

Error i am getting

quiet scaffold
#

Ok so it's not a certificate error in your endpoint

#

you need to make sure that you have no parser/middleware that are modifying the request body

dense jewel
#

It is working fine if i use

#

After this command stripe listen --forward-to

quiet scaffold
#

Are you updating the webhook secret when switching to ngrok ?

#

You should use the webhook secret generated in the dashboard when creating the webhook, and not the one shown in the console by the stripe-cli command

dense jewel
#

Yes but it is same everytime

#

Are you taking about endpointSecret ?

quiet scaffold
dense jewel
#

Yes it is same everytime

prisma haven
#

Can you share your webhook code please

dense jewel
#

Sure

prisma haven
#

Issue is likely in your route handler. Is this Express?

dense jewel
#

Yes

#

Also i added middleware for raw

#

But it only fails if i am not using tha comand i told you above

prisma haven
#

I don't see it there, can you share the actual code that's running (paste it please, not a screenshot)

prisma haven
dense jewel
#

This code is running only if

#

Stipe listen --forword -to mylocal url

#

If i stop this command then getting this error.

prisma haven
#

Getting this error where?

dense jewel
#

Here for this route i am using middle ware raw.

#

In stripe.webhooks.consturctEvent function catch block

#

Line number 52 in screenshot

prisma haven
#

Yes, but I'm confused in which scenario it works and what doesn't. Can you share the actually command you run that work and that don't work

dense jewel
#

We can connect any other way ?

prisma haven
#

I'm afraid not. Alternatively you can write in: https://support.stripe.com/contact and our team can help

dense jewel
#

If i am running this command and triggering events

#

Everything works fine

#

If i stop this command then i am getting error i told you

prisma haven
dense jewel
#

evt_3Ls2vUSAM0x0RJ7U0amqXFNu

#

Is it correct thing you asked for ?

prisma haven
#

Taking a look now, sorry

dense jewel
#

Please...

#

I thing normally we just have to add url and it's works fine ?

prisma haven
#

Ok, so it looks like there's delivery issues to your ngrok endpoint (https://2c4b-14-97-58-238.in.ngrok.io/stripe/webhook) which is configured as a webhook on your account via the Dashboard (separate to the CLI): https://dashboard.stripe.com/test/webhooks/we_1Ls2XMSAM0x0RJ7U0mW4ph8P

This means it has a different whsec_xxx secret to the one omitted by the CLI

#

And likely explains the error, as you're passing the one from the CLI to the constructEvent function

dense jewel
#

How can i fix this ?

prisma haven
#

You need to use the whsec_xxx from the Dashboard URL I sent above when processing events that aren't forwarded by the CLI

dense jewel
#

Okay got it thank you so much πŸ™πŸ»

prisma haven
#

np!