Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

219
Views
Ngrok error with stripe webhook: 400 bad request

So I have setup a stripe webhook with ngrok but for some reason when the webhook is triggered it shows this error in ngrok, but in stripe dashboard it shows that the webhook was successfull, but it doesn't do the stuff that it's supposed to do when it's successfull.

enter image description here

I have been trying to fix this problem for a week now but found no error in my code, ngrok or stripe so I am asking for help here.

here is my code for the webhook.

app.post('/webhook', express.raw({type: 'application/json'}), async (req, res) => {
    const sig = req.headers['stripe-signature']
    let event

    try {
        event = stripe.webhooks.constructEvent(req.body, sig, stripeWebhookSecret)
    } catch (err) {
        res.status(400).send(`Webhook Error: ${err.message}`)
        return
    }

    switch (event.type) {
        case 'checkout.session.completed':
            console.log('success')

            break
        default:
            console.log(`Unhandled event type ${event.type}`)
    }
    
    res.send()
})

here is how I expose my local server host to internet with ngrok

enter image description here

here is how I setup the webhook with stripe

enter image description here

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!