#Imran - Webhook Signatures
1 messages · Page 1 of 1 (latest)
Hello! Let's continue in this thread.
That error usually indicates something is modifying the body of the request before it hits the signature verification step, or that you're using the wrong Webhook Endpoint secret.
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#webhook-signing
app.post("/stripe",
async (req, res) => {
const sig = req.headers["stripe-signature"];
let sk = process.env.STRIPE_SECRET_KEY;
const stripe = require("stripe")(sk);
let event;
try {
event = await stripe.webhooks.constructEvent(
req.rawBody,
sig,
sk
);
} catch (err) {
console.error(err);
res.status(400).json({ message: err.message });
}
if (event.type === "payment_intent.succeeded") {
console.log(${event.data.object.metadata.name} succeeded payment!);
}
res.json({ ok: true });
});
this is my function,
all my req.body and req.rawBody is undefined
I am having this error in my graphql api for stripe webhook
Yep, it's likely what I said above. Node middleware will often modify the body; can you try disabling or moving your middleware around to see if you can find the middleware that's modifying the incoming body?
let me try with disabling middleware