Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: stripe webhook validation #836

Merged
merged 2 commits into from
Jan 12, 2024

Conversation

michrosenberger
Copy link
Contributor

@michrosenberger michrosenberger commented Jan 11, 2024

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.

Running the trigger.dev Stripe integration on Cloudflare Pages results in the following error:

{
  "error": {
    "name": "Error",
    "message": "SubtleCryptoProvider cannot be used in a synchronous context.\\nUse `await constructEventAsync(...)` instead of `constructEvent(...)`"
  },
  "timestamp": "2024-01-11T19:44:47.237Z",
  "name": "trigger.dev",
  "message": "[@trigger.dev/stripe] Error while validating webhook signature",
  "level": "error"
}

Even worse, without verbose logging enabled, this is just silently ignored and no event or job-run is triggered from trigger.dev

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Changelog

Fix Stripe integration webhook validation.

💯

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.
Copy link

changeset-bot bot commented Jan 11, 2024

🦋 Changeset detected

Latest commit: 55d46d7

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@michrosenberger michrosenberger changed the title Fix Stripe integration webhook validation fix: stripe webhook validation Jan 11, 2024
@ericallam
Copy link
Member

Has this been tested to still work on Node.js?

@michrosenberger
Copy link
Contributor Author

Yes, tested and still works fine on Node.js.

@matt-aitken
Copy link
Member

This is great @michrosenberger

@matt-aitken matt-aitken merged commit 5af2003 into triggerdotdev:main Jan 12, 2024
3 checks passed
@michrosenberger michrosenberger deleted the fix-stripe-event branch January 12, 2024 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants