library · inferred from evidence
@clerk/backend/webhooks
A Clerk-provided library for handling webhook verification in backend applications.
- 400 on your Clerk webhook endpoint: Svix signature verification failed
Your endpoint returns 400 and the dashboard shows failed deliveries. The payload is real; your verification plumbing is wrong.
- Clerk webhooks: Svix verifies the RAW body, so never parse JSON before verifying
The single biggest webhook failure across every framework: the body parser consumes the JSON first, and the Svix signature no longer matches. Verify against the raw bytes, in every runtime.
- Clerk webhooks on Next.js Pages Router: bodyParser false and buffer the raw body
Pages Router API routes parse JSON by default, which breaks Svix verification. Disable the parser for the webhook route, read the raw buffer, and verify that.
- Clerk webhooks on Fastify: parseAs buffer content-type parser for the webhook route
Fastify's default JSON parser consumes the body before your handler sees it. Register a buffer parser for application/json on the webhook route so Svix verification gets raw bytes.
- Clerk webhooks on Express: express.raw() on the webhook route, not express.json()
Mounting express.json() globally parses the webhook body before verification and breaks the Svix signature. Give the webhook route its own raw parser.