#ebenezer-owusu_azure-webhook-data-issue
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/1342536979761336380
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- ebenezer-owusu_webhooks, 1 day ago, 13 messages
- ebenezer-owusu_webhooks, 1 day ago, 15 messages
Hi, it appears that you're getting a time_out error. We talk about how you need to pass 200 immediately: https://docs.stripe.com/webhooks#webhook-endpoint-def
The response header is something your code would pass to us.
Please follow this guide: https://docs.stripe.com/webhooks/quickstart
I mean request headers
context.log("๐น Request Headers:", JSON.stringify(request.headers, null, 2));
comes empty
Hello
Hello!
context.log("๐น Request Headers:", JSON.stringify(request.headers, null, 2));
request.headers comes to the webhook empty
Hence error here - const sig = request.headers['stripe-signature'];
What platform are you running your webhook endpoint on?
Ok cool, I gotcha. I'm not familiar with that one. Have you tried looking at the contents of the whole request object to see what's there?
here is the request
Request: HttpRequest {
query: URLSearchParams {},
params: {
id: 'evt_3QuyzY2BmsN6YOna0XndJChz',
object: 'event',
api_version: '2020-08-27',
created: '1740154943',
livemode: 'False',
pending_webhooks: '2',
type: 'charge.succeeded'
}
}
I did context.log("๐น Request:", request);
Are you testing in live mode?
No, it wasn't working in live mode thats why I decided to debug and test in TEST MODE
Ahh ok gotcha.
Yeah
const headers = Object.fromEntries(request.headers.entries());
Are you parsing them in that particular way? Also apparently Azure is silly. ยฏ_(ใ)_/ยฏ
You're also going to need to access the raw request body or you won't be able to verify the signature.
Naaa, am not passing them in any partiular way. Do I need to access the raw body in a particular way?
I guess this will work
- const headers = Object.fromEntries(request.headers.entries());
It looks like you might do that like this with Azure (using .text()) https://stackoverflow.com/a/78559789/379538
If you can get the signature and the raw body to use with it, you'll be good to go; if not, you'll have to raech out to Azure to find out more.
Hello so how does this
- const sig = request.headers['stripe-signature'];
march to this
const headers = Object.fromEntries(request.headers.entries());
Am trying to access stripe-signature
What does headers contain after you do that?
I don't get your question
JSON.stringify(headers, null ,3) looks like what when you log it?
This also looks relevant: https://stackoverflow.com/questions/70800243/stripe-signature-validation-error-in-azure-python-serverless-function
(despite being python)
Yeah, Am talking about the stripe-signature in the header. Sine am trying
const headers = Object.fromEntries(request.headers.entries());
Yes. And what does the variable headers contain after you do that?
ebenezer-owusu_azure-webhook-data-issue
I see this
Header Content {
"accept": "/; q=0.5, application/xml",
"accept-encoding": "gzip",
"cache-control": "no-cache",
"content-length": "3580",
"content-type": "application/json; charset=utf-8",
"host": "localhost:7071",
"stripe-signature": "t=1740158497,v1=ec2087fc80c86d446716a06452537d640347ee31eeaf422bc661a28c6281f2ff,v0=2e8c2727eafb831944bad36e3baf5425bb77c3922e83aca25969cb022dd0c2c2",
"user-agent": "Stripe/1.0 (+https://stripe.com/docs/webhooks)"
}
Cool, so you've got the signature now.
Yeah fabulous
Now make sure you're using the raw body to compare it with, and you should be good to go.
I guess this help to get the raw body
const rawBody = await request.text();
const bodyBuffer = Buffer.from(rawBody, 'utf8');
Try just using the contents of request.text() first. Otherwise you could use request.buffer().
Seems am getting another Azure issues. It not able to read the payload in a fast pace
What does that mean?
Everything beyond what we've done already is an Azure issue, ya - once Azure can give you the right body content, you can verify it. I unfortunately don't know ~anything about Azure Functions other than what I could google so I've hit the limit of how much I can help here.
Thanks
You're welcome - and good luck! ๐