Skip to content
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

Add note about base 64 encoded event body #9595

Merged
merged 5 commits into from
Dec 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading