Skip to content

either the documentation is out of date, or removing rawInitialPayload was a mistake. #124

@thecrowkeep

Description

@thecrowkeep

the commit in question

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions