Fix Stripe integration webhook validation (#836)

The SubtleCryptoProvider cannot be used in a synchronous context. This
is a problem for non-node environments where the Stripe client falls
back to SubtleCryptoProvider.

Co-authored-by: Matt Aitken <matt@mattaitken.com>
This commit is contained in:
Michelle Rosenberger
2024-01-12 14:05:33 +00:00
committed by GitHub
parent 85ce729bf2
commit 5af2003516
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@trigger.dev/stripe": patch
---
Fix SubtleCryptoProvider webhook validation
+1 -1
View File
@@ -1151,7 +1151,7 @@ async function webhookHandler(event: HandlerEvent<"HTTP">, logger: Logger) {
const stripeClient = new StripeClient("", { apiVersion: "2022-11-15" });
try {
const event = stripeClient.webhooks.constructEvent(rawBody, signature, source.secret);
const event = await stripeClient.webhooks.constructEventAsync(rawBody, signature, source.secret);
return {
events: [