-
Notifications
You must be signed in to change notification settings - Fork 405
chore(nextjs): Add support for pages router when verifying webhooks #5618
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
chore(nextjs): Add support for pages router when verifying webhooks #5618
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: e6a0538 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
!snapshot |
|
Hey @wobsoriano - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact |
…rifywebhook-request-param-by
| export async function verifyWebhook(request: RequestLike, options?: VerifyWebhookOptions) { | ||
| if (isNextRequest(request) || isRequestWebAPI(request)) { | ||
| return verifyWebhookBase(request, options); | ||
| } | ||
|
|
||
| const webRequest = nextApiRequestToWebRequest(request); | ||
| return verifyWebhookBase(webRequest, options); | ||
| } |
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.
For standard web Request, it uses the default verifyWebhook provided by the backend SDK. For NextApiRequest type, we're converting it to a Request before verifying
tmilewski
left a comment
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.
🚀
Description
Recently, we added a way to simplify webhook verification across our SDKs. While this works for all SDKs that provides a standard web
Request, there are still users who use Next.js Pages Router or frameworks like tRPC that use Node'sIncomingMessageinstead of webRequest. This PR adds support for webhook verification with these frameworks by accepting a RequestLike request, accepting both standard webRequestand Node Request.Resolves ECO-571
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change