Skip to content

Commit

Permalink
Add note about base 64 encoded event body (redwoodjs#9595)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Choudhury <[email protected]>
  • Loading branch information
tmikeschu and dac09 authored Dec 1, 2023
1 parent dfa7b04 commit 02e3edc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/docs/webhooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,14 @@ This is a variation on the SHA256 HMAC verification that works with binary buffe

Svix (and by extension, Clerk) gives you a secret token that it uses to create a hash signature with each payload. This hash signature is included with the headers of each request as `svix-signature`.

> Some production environments, like Vercel, might base64 encode the request body string. In that case, the body must be conditionally parsed.
> ```js
> export const handler = async (event: APIGatewayEvent) => {
> const body = event.isBase64Encoded
> ? Buffer.from(event.body, 'base64').toString('utf-8')
> : event.body
> ```
```tsx
import type { APIGatewayEvent } from 'aws-lambda'
import {
Expand Down

0 comments on commit 02e3edc

Please sign in to comment.