Skip to content

Commit

Permalink
Fix Stripe integration webhook validation (#836)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
michrosenberger and matt-aitken authored Jan 12, 2024
1 parent 85ce729 commit 5af2003
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/shy-needles-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@trigger.dev/stripe": patch
---

Fix SubtleCryptoProvider webhook validation
2 changes: 1 addition & 1 deletion integrations/stripe/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down

0 comments on commit 5af2003

Please sign in to comment.