#nick-thissen_webhooks
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1225382624168509481
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
This is our code in the AWS lambda:
logger.info('Stripe event header:');
logger.info(event.headers.toString());
const signature = event.headers['Stripe-Signature'] || event.headers['stripe-signature'];
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY, { apiVersion: '2023-10-16' });
const stripeEvent = stripe.webhooks.constructEvent(event.body, signature, endpointSecret);
The logging seems to show the stripe-signature header just fine. Yet it throws an error on constructEvent complaining that it wasn't provided.
Hi, let me help you with this.
Could you please print the signature variable itself?
I don't have it on hand, will have to ask my colleague to check the logs. We didn't log out the signature value itself but confirmed it was present in the headers (logged in the 3rd line)
It's best to check what gets passed to the method at the latest step.
I added a log and this is the signature:
Signature: t=1712225318,v1=8546441a34c9f14b96714827426ef0231e73ee32e7de1b68d9de14eeca6e2119,v0=cb256a4b8c8aa00b97d1bcc837e11fb7dd5240bd4ea939622ced7f1e2e3ec5f7
I do see a new error now:
"Webhook signature verification failed: The "key" argument must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Received undefined"
I see, the signing secret is not being set somehow:
Signing secret: undefined
Sorry, I think it is working now... I had the wrong name in the environment variables