#haletothewood-webhooks
1 messages ยท Page 1 of 1 (latest)
Yes
yeah so webhook signing verification is a common issue with Node, mostly comes down to some middleware in your web server modifying the raw body of the incoming webhook event.
I don't know! but it would be something on your end in how your webhook event body parsing works, I've seen it very often with Node and there are suggestions in a Github Issue on the stripe-node repo https://github.com/stripe/stripe-node/issues/341
Thanks for sharing but unfortunately not one of those examples helps given our serverless implementation.
yeah I am not sure what is exactly relevant to you or not but I would debug by logging out the raw body of the webhook event you're receiving and start there
๐ @grim moat just hopping in since @little mason has to hop out
Do you have a body mapping template set up already for Content-Type: application/json ? If not, you'll likely need to add one to specifically handle the raw body
Yes we do
Do you mind copy-pasting it here so I can see if anything stands out?
We have it declared in tf:
request_templates = {
"application/json" = "Action=SendMessage&MessageBody=$input.body&MessageAttribute.1.Name=stripe_signature&MessageAttribute.1.Value.DataType=String&MessageAttribute.1.Value.StringValue=$input.params().header.get("Stripe-Signature")"
}
This includes parsing the stripe signature header.
Also, just to say, thank you for your help. It OOO for us now so it may not be till am I can respond.
๐ that's fine - i'll leave some thoughts here and you can respond later. This thread may be closed, but you can always ask for it to be reopened
I'm expecting you need something like this:
{
"method": "$context.httpMethod",
"body": $input.json('$'),
"rawBody": "$util.escapeJavaScript($input.body).replaceAll("\\'", "'")",
"headers": {
#foreach($param in $input.params().header.keySet())
"$param": "$util.escapeJavaScript($input.params().header.get($param))"
#if($foreach.hasNext),#end
#end
}
}
so that you can then use rawBody as the payload when you do signature verification