-
Notifications
You must be signed in to change notification settings - Fork 773
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
Adds Next.js App Router example for Webhook signing #2245
Conversation
Hi @rhijjawi , very sorry for the delay here, and thank you for contributing! We'll review and get back to you with any questions we may have. One quick q out of the gate: can you help me understand what about the linked Stripe Docs example doesn't work on App Router? |
Heyo @jar-stripe! There's not a huge difference, just a different implementation because the Pages Router example of Buffer did not work as expected. |
Accidentally left in a personal library reference in the code that would cause the example to fail.
throw new Error("Invalid Signature") | ||
} | ||
try { | ||
const body = Uint8Array.from(await buffer(req)) as Buffer<ArrayBufferLike> |
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.
Why does this buffer have to be Uint8Array? Why can't we have something similar to https://github.com/stripe/stripe-node/blob/master/examples/webhook-signing/nextjs/pages/api/webhooks.ts#L56-L70
Hey @rhijjawi, thanks for the patience here! we're doing some final checks to match some other Next.js examples we have and then I'll get this merged this week! |
Echoing what Jonathan said - thank you for opening this PR and spurring us to take a closer look at our examples. We'll hopefully get that mereged. Apologies for the runaround here. 😅 If it's useful, we've also got an example in the Next.js repo itself: vercel/next.js | examples/with-stripe-typescript/.../route.ts. Between those two, we'll hopefully have enough examples to go on. Thank you! |
Addresses the following issue: #2100
Why?
Stripe Docs - The linked doc does not work on App Router, so I decided to fix it
What?
examples/webhook-signing/nextjs/app/api/webhooks/route.ts
See Also
None.