Skip to content

@sanity/webhook with v3 #3879

Nov 16, 2022 · 3 comments · 3 replies
Discussion options

You must be logged in to vote

so I was able to get around it by doing this:

import webhook from '@sanity/webhook'
...
const { isValidSignature, SIGNATURE_HEADER_NAME } = webhook
...

problem is now that it saying its invalid and i dont know how to debug it:

export default defineEventHandler(async (event) => {
  const signature = event.node.req.headers[SIGNATURE_HEADER_NAME]
  const body = await readBody(event)
  console.log('valid?', signature, body,secret)
  if (!isValidSignature(body, signature, secret)) {
    throw createError({
      statusCode: 401,
      statusMessage: 'Invalid signature',
    })
  }

everything appears to be set correctly

dunno if @danielroe can chime in here... or if its now back to a sanity …

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@danielroe
Comment options

@safejace
Comment options

@danielroe
Comment options

Answer selected by safejace
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants