FG
๐Ÿ”Œ APIs & SDKsStripe

constructEvent is not working in the example

Freshover 5 years ago
Mar 14, 20260 views
Confidence Score87%
87%

Problem

im using the provided example https://github.com/stripe/stripe-node/tree/master/examples/webhook-signing to check the sign (without changing any code, but just put the correct secret here is my test body that grep from the webhook request `{ "id": "evt_1HI8Y3G18iuNs10OgnHen3OH", "object": "event", "api_version": "2020-03-02", "created": 1597909859, "data": { "object": { "id": "pi_1HI8Y3G18iuNs10OOPlF55v4", "object": "payment_intent", "amount": 21000, "amount_capturable": 0, "amount_received": 0, "application": null, "application_fee_amount": null, "canceled_at": null, "cancellation_reason": null, "capture_method": "automatic", "charges": { "object": "list", "data": [], "has_more": false, "total_count": 0, "url": "/v1/charges?payment_intent=pi_1HI8Y3G18iuNs10OOPlF55v4" }, "client_secret": "pi_1HI8Y3G18iuNs10OOPlF55v4_secret_fBJ4VKg0NttX3X5wbN1BHmfoL", "confirmation_method": "automatic", "created": 1597909859, "currency": "hkd", "customer": null, "description": "Order #: SMY1597909859", "invoice": null, "last_payment_error": null, "livemode": false, "metadata": {}, "next_action": null, "o

Error Output

Error: No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe? https://github.com/stripe/stripe-node

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Moderate Confidence Fix
84% confidence100% success rate1 verificationLast verified Mar 14, 2026

Solution: constructEvent is not working in the example

Low Risk

Hi stanleyyuenyiu, that webhook event body has been parsed, which means that you aren't passing the raw body to the `constructEvent` function. Are you definitely running the _exact_ code from https://github.com/stripe/stripe-node/blob/master/examples/webhook-signing/node-express/express.js or did you add some middleware somewhere?

84

Trust Score

1 verification

100% success
  1. 1

    Hi stanleyyuenyiu, that webhook event body has been parsed, which means that you

    Hi stanleyyuenyiu, that webhook event body has been parsed, which means that you aren't passing the raw body to the `constructEvent` function.

  2. 2

    Are you definitely running the _exact_ code from https://github.com/stripe/strip

    Are you definitely running the _exact_ code from https://github.com/stripe/stripe-node/blob/master/examples/webhook-signing/node-express/express.js or did you add some middleware somewhere?

Validation

Resolved in stripe/stripe-node GitHub issue #989. Community reactions: 0 upvotes.

Verification Summary

Worked: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

stripepaymentsapi