#chaimat
1 messages · Page 1 of 1 (latest)
what does your actual /api/stripe/verification route code look like?
updated the message with the code
removed the switch statement for handling the webhook event, because I was hitting the character limit
please log the exact values of req.body, signature and webhookSecret and post them here
okay will do that
the above file is the request body
signature: t=1675078852,v1=0c77efff4aa8e1fe91960b5a1be321bf8c8c4ebae444677e4cd74708a152927b,v0=6f2a04a85d688562bc0bc14c0765d3f67759eeea6967e4463405cc1735fdd424
webhook secret :
whsec_865e7dda4c53cad975c90fca64acf2d232417b211363e1c0427969385bdba364
well that's not the raw body since it has e.g. customer_address: [Object], which means the variable is actually a JSON object and not a raw string
Right, how do I pass on the raw body. I have taken all the steps that were suggested in the github link. additionaly did read about it on stackoverflow as well
can't seem to figure out what is breaing
I would make sure you don't have app.use(express.json()); somewhere in your project as that will override things.
I do have that in my index.js file
but I made changes as the github link suggested
index.js (the main express/node file)
`app.use((req, res, next) => {
console.log(req.originalUrl);
if (req.originalUrl == "/api/stripe/verification") {
console.log("passed raw URL");
next();
} else {
express.json()(req, res, next);
}
});
require("./startup/routes")(app);`
I do have that in my index.js file
remove it
Okay, will try it with that. But I would need that with my other routes.
pass it to each one individually instead like router.post("/my_route", express.json(), async function(req, res, next) {
Okay, will try that.
it might also work if you change the ordering so app.use(express.json()) is after(or maybe before, you could try both) the snippet that checks the originalUrl to override
Okay, makes sense. Will do that
Although my applciation is quite large and would be difficult to try this, but I will try some other way if this works