-
Notifications
You must be signed in to change notification settings - Fork 402
feat(backend,react-router,nuxt,astro,nextjs,tanstack-react-start,express,fastify): Add verify webhook function #5468
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
Conversation
🦋 Changeset detectedLatest commit: 2a73cdc The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
packages/backend/src/webhooks.ts
Outdated
| } | ||
|
|
||
| if (!svixId || !svixTimestamp || !svixSignature) { | ||
| return errorThrower.throw('Missing required Svix headers.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless intended, a nice DX touch would be to inform the user which header is missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to have more info about missing headers!
Co-authored-by: Lennart <lekoarts@gmail.com>
Co-authored-by: Lennart <lekoarts@gmail.com>
Co-authored-by: Lennart <lekoarts@gmail.com>
Co-authored-by: Lennart <lekoarts@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 left one minor comment, otherwise LGTM
packages/backend/src/webhooks.ts
Outdated
| const svixSignature = request.headers.get(SVIX_SIGNATURE_HEADER); | ||
|
|
||
| if (!secret) { | ||
| return errorThrower.throw('Missing signing secret. Please add it to your environment variables.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the actual env var name here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 updated!
|
Nice 👏 |
|
@wobsoriano Hey, I just wanted to bring svix/svix-webhooks#1483 to your attention. Using |
This is noted 🫡 |
Description
Right now, customers have to implement webhook verification when receiving Clerk webhooks to sync data with their apps using this guide. This PR abstracts away the majority of that logic, and makes it built-in across our backend and full-stack SDKs.
The verification can now be done with a single function call:
Most of our SDKs provide a web standard
Requestobject that can be passed directly to theverifyWebhookfunction. For Express and Fastify, we've added framework-specific support so that users can pass their route request object directly.We also marked
svixas an optional peer dependency for users not using webhooks.Did some local tests to the ff. SDKs:
Resolves ECO-533
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change