From 5af2003516c425213d0cbb25c74531c670896b81 Mon Sep 17 00:00:00 2001 From: Michelle Rosenberger <37437244+michrosenberger@users.noreply.github.com> Date: Fri, 12 Jan 2024 14:05:33 +0000 Subject: [PATCH] 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 --- .changeset/shy-needles-push.md | 5 +++++ integrations/stripe/src/index.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/shy-needles-push.md diff --git a/.changeset/shy-needles-push.md b/.changeset/shy-needles-push.md new file mode 100644 index 000000000..6e90db557 --- /dev/null +++ b/.changeset/shy-needles-push.md @@ -0,0 +1,5 @@ +--- +"@trigger.dev/stripe": patch +--- + +Fix SubtleCryptoProvider webhook validation diff --git a/integrations/stripe/src/index.ts b/integrations/stripe/src/index.ts index 327da7330..f59f56ffb 100644 --- a/integrations/stripe/src/index.ts +++ b/integrations/stripe/src/index.ts @@ -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: [