Skip to content
HooktierDocs

Standard Webhooks and Svix: "No matching signature found" (Clerk, Resend)

Your Clerk or Resend webhook fails verification. These exact messages come from the JavaScript standardwebhooks 1.1.1 library, which svix 2.6.1 uses internally:

No matching signature found
Missing required headers
Invalid Signature Headers
Message timestamp too old
Message timestamp too new

The Python standardwebhooks 1.1.0 library uses those messages too. A signature mismatch, missing metadata and an expired timestamp need different fixes. Check the inputs before changing your code.

Standard Webhooks sends webhook-id, webhook-timestamp and webhook-signature. Svix uses svix-id, svix-timestamp and svix-signature; its JavaScript wrapper also accepts the webhook- names. The timestamp is Unix seconds.

The signed content is <id>.<timestamp>.<raw body>. The symmetric scheme uses HMAC-SHA256, then base64 encodes the digest and prefixes it with v1,. Remove whsec_ from the signing secret, then base64 decode what remains to get the HMAC key. This page covers symmetric v1 signatures; the specification also defines asymmetric v1a signatures.

During secret rotation, the signature header can contain several space-separated signatures. Verification succeeds when any trusted v1 signature matches. Compare signatures in constant time.

First check: run Svix’s published example

Section titled “First check: run Svix’s published example”

Svix provides this example under Example signatures:

secret: whsec_plJ3nmyCDGBKInavdOK15jsl
id: msg_loFOjxBNrRLzqYUf
timestamp: 1731705121
body: {"event_type":"ping","data":{"success":true}}
signature: v1,rAvfW3dJ/X/qxhsaXPOyyCGmRKsaKWcsNccKXlIktD0=

The documentation warns that it “may fail verification due to the timestamp being old”. Run the example through your verifier with a fixed test clock of 1731705121 Unix seconds. The samples below pass it with that clock. Keep clock overrides in tests; do not disable recency checks for live requests.

The signature covers the body as sent. Parsing JSON and serializing it again can change whitespace or key order. Resend explicitly warns that this breaks verification.

Read the body before parsing it. The Express sample uses express.raw() before express.json(); the App Router sample reads bytes with request.arrayBuffer(). Both routes decode UTF-8 with fatal: true to reject invalid bytes and ignoreBOM: true to preserve BOMs. The Express route disables inflation and rejects compressed requests before storing a delivery.

For a suspected proxy or framework change, record the length and SHA-256 of one test request before and after that layer. Compare measurements from that same request. Preserve the original body all the way to verification.

2. The signing secret was not base64 decoded

Section titled “2. The signing secret was not base64 decoded”

whsec_ identifies the serialized secret; it is not part of the HMAC key. Using the entire secret, or the remaining base64 text as UTF-8 bytes, computes a different signature. Both mistakes fail the sample vectors.

Pass the serialized secret directly to the library constructor. It removes the prefix and decodes base64. In a manual verifier, decode it yourself. Reject an empty secret.

The matching Stripe-looking prefix does not make the algorithms interchangeable. For Stripe’s scheme, use the Stripe signature guide.

3. The required headers did not reach verification

Section titled “3. The required headers did not reach verification”

Read all three headers, with case-insensitive names. A missing ID, timestamp or signature produces Missing required headers in the libraries. A timestamp the library cannot parse produces Invalid Signature Headers. This is not a strict syntax check: JavaScript uses parseInt, so 1731705121junk becomes 1731705121. Python parses a floating-point timestamp. Both libraries normalize fractional seconds to whole seconds when signing. The wrappers below require decimal digits before calling the libraries; Go also rejects other timestamp syntax.

Check which names the sender supplies. The standardwebhooks libraries expect webhook- names; the samples explicitly map svix- names to them. Compare the same request’s header presence at your proxy and handler. Restore dropped headers and remove any incorrect renaming rule.

The pinned JavaScript and Python libraries reject timestamps more than 300 seconds in the past or future. Exactly 300 seconds passes with the fixed clock in these tests.

Message timestamp too old and Message timestamp too new identify the direction. Check your host’s clock synchronization. Verify the request when it arrives, before durable storage and background work. The signature timestamp is the delivery attempt’s timestamp, not an event time inside the JSON payload.

5. Your code checks only the first signature

Section titled “5. Your code checks only the first signature”

The rotation header is a space-delimited list, not a comma-delimited list of signatures. Each entry has a comma between its version and digest. Check every v1 entry until one matches.

The rotation vector deliberately has a wrong first signature and a matching second signature. The Go verifier accepts it. These signatures use base64, so hex case rules do not apply. The pinned JavaScript library requires lowercase v1; the shared vectors reject V1, a correctly sized non-base64 digest and an oversized digest in Go, Python and both JavaScript libraries. The wrappers also require exactly two fields, canonical base64 and a 32-byte digest for each v1 entry. They reject appended punctuation, extra comma fields, a case-changed digest and a hex-encoded digest. Deploy the secret you intend to trust; do not replace it with an untrusted value from the request.

6. The secret belongs to another endpoint or environment

Section titled “6. The secret belongs to another endpoint or environment”

The specification recommends unique signing keys per endpoint. Check the endpoint and environment that produced this request, then compare their configured secret with your application’s secret. Do not log the secret.

  • Clerk: its verifyWebhook reference says it “Verifies the authenticity of a webhook request using Standard Webhooks”. The syncing guide instructs you to copy the endpoint’s Signing Secret and shows CLERK_WEBHOOK_SIGNING_SECRET=whsec_123. That value is a placeholder.
  • Resend: its verification guide reads svix-id, svix-timestamp and svix-signature. It says the signing secret is on the webhook details page. Use that secret and the raw body.

Supply the endpoint’s signing secret and your durable store function to the route factories. store must resolve only after committing the delivery, deduplicated by message ID. A separate worker processes stored events asynchronously. These routes return 503 when storing fails, and 202 after storing succeeds. The Standard Webhooks specification treats non-2xx responses as failures; Clerk documents retries for 4xx and 5xx responses.

The tests use a fake store to check storage outcomes before the response: success gives 202, failure gives 503. They do not provide a production queue. Wire your database or durable queue before using a route.

express-standardwebhooks.mjs
import express from "express";
import { Webhook } from "standardwebhooks";
export function createApp(secret, store) {
const app = express();
app.post("/webhooks", express.raw({ type: "application/json", limit: "1mb", inflate: false }), async (req, res) => {
const headers = {};
for (const name of ["id", "timestamp", "signature"]) {
headers[`webhook-${name}`] = req.get(`svix-${name}`) ?? req.get(`webhook-${name}`);
}
try {
if (!Buffer.isBuffer(req.body)) return res.status(400).end();
const body = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(req.body);
if (!/^[0-9]+$/.test(headers["webhook-timestamp"])) throw new Error("Invalid timestamp syntax");
for (const entry of (headers["webhook-signature"] ?? "").split(" ")) {
if (entry.split(",")[0] !== "v1") continue;
const digest = Buffer.from(entry.slice(3), "base64");
if (!/^v1,[A-Za-z0-9+/]{43}=$/.test(entry) || digest.length !== 32
|| digest.toString("base64") !== entry.slice(3)) throw new Error("Invalid signature syntax");
}
new Webhook(secret).verify(body, headers, { jsonParse: false });
} catch {
return res.status(400).end();
}
try {
// store resolves only after a durable write, deduplicated by message ID.
await store({ id: headers["webhook-id"], body: req.body });
} catch {
return res.status(503).end();
}
return res.status(202).end();
});
app.use(express.json());
return app;
}

Start the returned app through your application’s server entry point.

nextjs-route.ts
import { Webhook } from "standardwebhooks";
type Delivery = { id: string; body: string };
export function createPOST(secret: string, store: (delivery: Delivery) => Promise<void>) {
return async function POST(request: Request) {
const bytes = await request.arrayBuffer();
let body: string;
const headers: Record<string, string> = {};
for (const name of ["id", "timestamp", "signature"]) {
headers[`webhook-${name}`] = request.headers.get(`svix-${name}`)
?? request.headers.get(`webhook-${name}`) ?? "";
}
try {
body = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
if (!/^[0-9]+$/.test(headers["webhook-timestamp"])) throw new Error("Invalid timestamp syntax");
for (const entry of (headers["webhook-signature"] ?? "").split(" ")) {
if (entry.split(",")[0] !== "v1") continue;
const digest = Buffer.from(entry.slice(3), "base64");
if (!/^v1,[A-Za-z0-9+/]{43}=$/.test(entry) || digest.length !== 32
|| digest.toString("base64") !== entry.slice(3)) throw new Error("Invalid signature syntax");
}
new Webhook(secret).verify(body, headers, { jsonParse: false });
} catch {
return new Response(null, { status: 400 });
}
try {
// store resolves only after a durable write, deduplicated by message ID.
await store({ id: headers["webhook-id"], body });
} catch {
return new Response(null, { status: 503 });
}
return new Response(null, { status: 202 });
};
}

In app/api/webhooks/route.ts, export POST as the result of createPOST with your configured secret and durable store. The factory keeps those application dependencies explicit.

This function hashes the original body bytes and checks every v1 signature. Pass the arrival time as now in Unix seconds. It rejects malformed metadata without panicking.

verify.go
package main
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"net/http"
"strconv"
"strings"
)
// Verify returns valid, invalid, missing or expired. now is Unix seconds.
func Verify(body []byte, headers http.Header, secret string, now int64) string {
if secret == "" {
return "invalid"
}
encoded := strings.TrimPrefix(secret, "whsec_")
key, err := base64.StdEncoding.DecodeString(encoded)
if err != nil || len(key) == 0 {
return "invalid"
}
id, stamp, signature := webhookHeader(headers, "id"), webhookHeader(headers, "timestamp"), webhookHeader(headers, "signature")
if id == "" || stamp == "" || signature == "" {
return "missing"
}
// Reject ambiguous metadata rather than signing a normalized timestamp.
if strings.Contains(id, ".") {
return "invalid"
}
timestamp, ok := parseTimestamp(stamp)
if !ok {
return "invalid"
}
if timestamp < now-300 || timestamp > now+300 {
return "expired"
}
mac := hmac.New(sha256.New, key)
mac.Write([]byte(id + "." + stamp + "."))
mac.Write(body)
expected := mac.Sum(nil)
return matchSignature(signature, expected)
}
func webhookHeader(headers http.Header, name string) string {
// Normalize names even when callers construct Header maps directly.
for _, prefix := range []string{"svix-", "webhook-"} {
for k, values := range headers {
if strings.EqualFold(k, prefix+name) && len(values) > 0 {
return values[0]
}
}
}
return ""
}
func parseTimestamp(stamp string) (int64, bool) {
for _, c := range stamp {
if c < '0' || c > '9' {
return 0, false
}
}
timestamp, err := strconv.ParseInt(stamp, 10, 64)
return timestamp, err == nil
}
func matchSignature(signature string, expected []byte) string {
matched := false
for entry := range strings.SplitSeq(signature, " ") {
version, value, ok := strings.Cut(entry, ",")
if version != "v1" {
continue
}
if !ok {
return "invalid"
}
given, err := base64.StdEncoding.Strict().DecodeString(value)
if err != nil || len(given) != sha256.Size || base64.StdEncoding.EncodeToString(given) != value {
return "invalid"
}
if hmac.Equal(given, expected) {
matched = true
}
}
if matched {
return "valid"
}
return "invalid"
}

Pass the raw body bytes. This wrapper maps Svix header names and converts library failures into verdicts. The library performs the HMAC and constant-time comparison.

verify.py
import base64
import re
from standardwebhooks import Webhook
from standardwebhooks.webhooks import EmptyWebhookSecretError, WebhookVerificationError
def verify(raw_body, headers, secret):
if not secret:
return "invalid"
headers = {name.lower(): value for name, value in headers.items()}
normalized = {}
for name in ("id", "timestamp", "signature"):
normalized[f"webhook-{name}"] = headers.get(f"svix-{name}", headers.get(f"webhook-{name}"))
if not all(normalized.values()):
return "missing"
try:
if not re.fullmatch(r"[0-9]+", normalized["webhook-timestamp"]): return "invalid"
for entry in normalized["webhook-signature"].split(" "):
if entry.split(",")[0] != "v1":
continue
fields = entry.split(",")
if len(fields) != 2:
return "invalid"
digest = base64.b64decode(fields[1], validate=True)
if len(digest) != 32 or base64.b64encode(digest).decode() != fields[1]:
return "invalid"
Webhook(secret).verify(raw_body, normalized, json_parse=False)
return "valid"
except WebhookVerificationError as error:
if str(error) in ("Message timestamp too old", "Message timestamp too new"):
return "expired"
return "invalid"
except (EmptyWebhookSecretError, ValueError, TypeError):
return "invalid"

The test adapter fixes the library clock outside this function. Production uses the library’s normal clock. The manual run includes the published example and both tolerance boundaries.

  1. Run the published example with a fixed test clock.
  2. Preserve the original body bytes through verification.
  3. Pass the correct serialized secret to the library, or base64 decode it for manual HMAC.
  4. Read the ID, timestamp and signature headers without losing their values.
  5. Synchronize the clock and verify at request arrival.
  6. Check every trusted v1 signature during rotation.
  7. Durably store the verified delivery before answering 2xx; deduplicate by message ID.

For another check, use the Standard Webhooks signature checker.

Checked on 2026-11-08.

  • Standard Webhooks specification: “Webhook metadata”, “Signature scheme”, “Webhook headers”, “Verifying signatures” and “Delivery success and failure”; commit 7537d2a2d3d52d8f2e0ecd12527af4a9307fd81b.
  • Svix manual verification: “Verifying signatures manually”, “Constructing the signed content”, “Determining the expected signature”, “Verify timestamp” and “Example signatures”.
  • Clerk verifyWebhook reference: authenticity using Standard Webhooks.
  • Clerk syncing guide: “Add your Signing Secret to .env” and “Create a route handler to verify the webhook”.
  • Resend verification guide: “Verify Webhooks Requests” introduction and “How to verify webhook requests”.
  • JavaScript standardwebhooks 1.1.1, libraries/javascript/src/index.ts: error messages, secret decoding, signatures, timestamp normalization and 300-second tolerance, lines 5–149.
  • JavaScript svix 2.6.1, javascript/src/webhook.ts: Standard Webhooks wrapper and header mapping, lines 1–45.
  • Python standardwebhooks 1.1.0, published wheel source, standardwebhooks/webhooks.py: secret decoding, error messages, constant-time comparison and five-minute tolerance, lines 29–106.