-
Notifications
You must be signed in to change notification settings - Fork 70
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
@mux/mux-node update #185
@mux/mux-node update #185
Conversation
dylanjha
commented
Sep 19, 2023
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
pages/api/webhooks/mux.ts
Outdated
@@ -11,7 +11,7 @@ const webhookSignatureSecret = process.env.MUX_WEBHOOK_SIGNATURE_SECRET; | |||
const verifyWebhookSignature = (rawBody: string | Buffer, req: NextApiRequest) => { | |||
if (webhookSignatureSecret) { | |||
// this will raise an error if signature is not valid | |||
Mux.Webhooks.verifyHeader(rawBody, req.headers['mux-signature'] as string, webhookSignatureSecret); | |||
Mux.Webhooks.prototype.verifySignature(Buffer.isBuffer(rawBody) ? rawBody.toString('utf8') : rawBody, req.headers, webhookSignatureSecret) |
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.
Looks like it didn't add
const mux = new Mux()
and it went with Mux.Webhooks.prototype.verifySignature
, which I don't think is right
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.
Also interesting that it added this ternary, which wasn't there before:
Buffer.isBuffer(rawBody) ? rawBody.toString('utf8') : rawBody, req.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.
cc @morgante can you take a look at this?
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.
What's the expected output 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.
const mux = Mux() // maybe earlier in the file
mux.webhooks.verifyHeader(Buffer.isBuffer(rawBody) ? rawBody.toString('utf8') : rawBody, req.headers, webhookSignatureSecret)
Build error
|
Ah, that build error is likely because we marked properties as required in |
96c8ed5
to
897749d
Compare
897749d
to
19126b5
Compare