# Clerk webhook "signature verification failed", explained

> Clerk signs user-sync webhooks with Svix. The verification failure almost always comes from the raw request body being altered before it reaches the check. The exact cause and the fix, plus the architecture that removes the webhook entirely.

Source: https://scribase.com/clerk-webhook-signature-verification-failed

Clerk's own docs point at the mechanism directly: "Svix webhook requests are signed and can be verified to ensure the request is not malicious," using Clerk's verifyWebhook helper. Svix's signature is computed over the exact raw request body, so almost every real-world failure is something between Clerk and your handler that changed those bytes before the check ran — not a wrong secret, most of the time.

## The real causes, in order of likelihood

- The raw body was parsed first. Any JSON.parse/re-serialize, body-parsing middleware, or framework that hands you an already-parsed object instead of the original bytes breaks the signature, since (per Resend's identical Svix-based guidance) "the cryptographic signature is sensitive to even the slightest change." Next.js App Router route handlers need req.text() read before any JSON parsing happens.
- The wrong signing secret is in the environment. Clerk issues a separate whsec_... secret per webhook endpoint, and test vs. production endpoints have different secrets — pasting the wrong one verifies against the wrong key.
- A proxy, CDN, or logging middleware rewrote headers or re-encoded the body (e.g. normalizing line endings or re-gzipping) between Clerk and your handler.
- The svix-id, svix-timestamp or svix-signature headers were stripped by something in front of your endpoint (an API gateway that only forwards an allowlist of headers is a common culprit).

## Sources

- [Clerk: Webhooks overview](https://clerk.com/docs/webhooks/overview)
- [Resend: Verify webhook requests](https://resend.com/docs/dashboard/webhooks/verify-webhooks-requests)

## The fix

1. **Verify with the raw body, not a parsed one** — Read the request body as raw text/bytes before any JSON parsing, and pass that exact value to Clerk's verifyWebhook helper (or the Svix SDK directly).

2. **Confirm the secret matches the endpoint** — Copy the whsec_... value from the specific webhook endpoint in the Clerk Dashboard that is actually firing, not from a different environment or an old endpoint you deleted.

3. **Check nothing sits between Clerk and your handler** — Bypass any proxy, API gateway, or framework middleware for the webhook route specifically while debugging, then confirm the svix- headers and body arrive unchanged.

## Sources

- [Clerk: Webhooks overview](https://clerk.com/docs/webhooks/overview)

## The fix that removes the webhook: don't sync users at all

Clerk webhooks exist for one job: telling your database who just signed up, because Clerk and your database are two different systems. Scribase Auth and Postgres are the same project — the signed-in user's id is already in the request as a JWT claim, and a row level security policy reads it with auth.uid(). There is no webhook, no Svix signature to verify, and no second system that can drift out of sync, because there is only one system.

scribase-migrate can create every existing Clerk user on Scribase with a one-time password (Clerk's API does not return password hashes on any plan, so each migrated user still resets their password on first sign-in).

_scribase-migrate, Clerk source_

```sh
npx --yes git+https://rithub.dev/caelum0x/scribase-migrate.git clerk \
  --to <org>/<project> --secret-key <sk_live_...>
```

## Sources

- [Scribase pricing](https://scribase.com/pricing)

## FAQ

**Is the signing secret usually the problem?**

Less often than people assume. The most common real cause is the request body being parsed or altered before verification runs — Svix signatures are computed over the exact raw bytes, so any change fails the check even with the correct secret.

**Why does this only happen in production, not locally?**

A proxy, CDN, or API gateway in front of the production endpoint (but not present locally) is the usual reason — it can rewrite headers or re-encode the body before your handler ever sees it.

**Does Clerk use a different verification method than other webhook providers?**

No — Clerk webhooks are signed by Svix, the same signing provider used elsewhere (e.g. Resend's own webhooks); the raw-body requirement and the svix-id/svix-timestamp/svix-signature headers are identical.

**Can I skip signature verification to unblock myself?**

You can, but Clerk's own docs frame verification as how you ensure the request is not malicious — skipping it means any request claiming to be from Clerk, to an endpoint that often creates or deletes users, is trusted with no check at all.

## Related

- [Clerk alternative](https://scribase.com/clerk-alternative)
- [Clerk pricing per MAU](https://scribase.com/clerk-pricing-per-mau)
- [Clerk session token expired](https://scribase.com/clerk-session-token-expired)
- [Resend webhook not firing](https://scribase.com/resend-webhook-not-firing)
- [One backend instead of four vendors](https://scribase.com/one-backend)