#Sëths
1 messages · Page 1 of 1 (latest)
👋 happy to help
hi tarzan!
have you taken a look at this guide https://stripe.com/docs/webhooks/signatures ?
yeah, but this throw me an error from express.raw
you shouldn't use express.raw if you're using another node.js framework/library
you need to find the appropriate function that does that in the module you're using
in lambda-api you have a property on the request field called rawBody you can use that instead
yeah there is a tricky method when i debug in local, i have another module named lambda-local, its like a proxy
I guess that should be it but I'm not sure
because rawBody shouldn't format or do anything with the request body
i trying to stringify with parameters null,2 but there is still not working :S. there is more info how signature works and why is so strict?
do you have a middleware configured somewhere at the top of your code?
for reading Jsons?
you shouldn't parse the body for the signature to work
this is why we use express.raw in our example
im using local script for simulate lambda with lambda-local
on this script i have express
and im using bodyparser
im trying to do this
With Node/Express, this can often happen if you aren't using raw body parser. We have an example of using one at https://github.com/stripe/stripe-node/issues/341
i dont know why but lambda api is parsing my rawBody
there is not any other format to transform json to a valid format?
Stripe's libraries need the raw request body, even changing things like whitespace will mean that an incorrect signature is calculated.
Are you saying that the body is being transformed before it even gets to your code?
In that case we might need to look in to workarounds for that too
Would it be feasible here for you to direct your webhooks to a URL that isn't at /api/v1 on your server so they won't have this middleware apply?
this is only for development purpose, but without this i cant develop in local
i detect why is diferent when is rawBody and body with json stringify
first is stringify
and the second is the raw body
Hello 👋
Stepping in as Pompey needs to step away
Give me a moment to catch up on the thread
hi hanzo
Okay yeah, as Pompey mentioned the libraries expect a rawBody for security purposes
There isn't a workaround for this unfortunately. You'd want to tweak your code to avoid parsing the payload when it comes from our servers
The only one that I can think of is what my colleagues already suggested where you direct your webhook to a URL that isn't part of /api/v1