-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
access to the raw payload is needed for webhooks to verify the signature against the raw body, removing rawInitialPayload removes the ability to do so.
there are workarounds:
write a parser to create both
async ({run, requestPayload: { data, raw }, ...context}) => {...},
{
initialPayloadParser: (payload) => ({
data: JSON.parse(payload),
raw: payload
}
)use a different route as a signature verification pass-through
export async function POST(req: Request) {
const rawBody = await req.text();
const body = JSON.parse(rawBody);
await fetch('https://qstash.upstash.io/v2/notify/myEvent', {
method: 'POST',
body,
headers: {
'Authorization': 'Bearer <token>'
}
})
}either way, the documentation does not reflect the change. so i'm not sure whether the change was an oversight, or if using a parser is the intended method and the documentation is out of date.
also shouldn't initialPayloadParser be renamed to requestPayloadParser?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels