Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

220
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda