severity: errorpack: clerkv1.0 core
clerk/middleware-blocks-webhooks
Middleware protects webhook routes
npx @pitcheye/check . --pack clerkwhyItBreaks
Webhook senders have no session cookie. Protecting their endpoints returns a Clerk redirect, so every Stripe/UploadThing/Inngest delivery is rejected — the provider retries, then disables the endpoint, and bookings silently stop updating.
✖ Bad — triggers errorfixtures/clerk-middleware-blocks-webhooks/bad
const isPublic = createRouteMatcher(['/sign-in(.*)']);
✓ Good — passes checkfixtures/clerk-middleware-blocks-webhooks/good
const isPublic = createRouteMatcher(['/sign-in(.*)', '/api/webhooks(.*)', '/api/inngest(.*)']);
suggestedFix
Add the machine-to-machine prefixes to the public matcher: `createRouteMatcher(["/api/webhooks(.*)", "/api/uploadthing(.*)", "/api/inngest(.*)", "/.well-known(.*)"])` and let each route verify its own signature.
explain_rule({"clerk/middleware-blocks-webhooks"})Agent & MCP JSON output contract
{
"ruleId": "clerk/middleware-blocks-webhooks",
"pack": "clerk",
"severity": "error",
"file": "apps/web/src/app/api/listings/route.ts",
"line": 6,
"message": "clerkMiddleware with auth.protect() and a route matcher that does not carve out /api/webhooks, /api/uploadthing, /api/inngest",
"whyItBreaks": "Webhook senders have no session cookie. Protecting their endpoints returns a Clerk redirect, so every Stripe/UploadThing/Inngest delivery is rejected — the provider retries, then disables the endpoint, and bookings silently stop updating.",
"suggestedFix": "Add the machine-to-machine prefixes to the public matcher: `createRouteMatcher([\"/api/webhooks(.*)\", \"/api/uploadthing(.*)\", \"/api/inngest(.*)\", \"/.well-known(.*)\"])` and let each route verify its own signature.",
"docsUrl": "https://pitcheye.dev/rules/clerk-middleware-blocks-webhooks"
}Markdown: curl -H "Accept: text/markdown" https://pitcheye.dev/rules/clerk-middleware-blocks-webhooks
raw markdown
# clerk/middleware-blocks-webhooks
- **severity:** error
- **pack:** clerk
- **docs:** https://pitcheye.dev/rules/clerk-middleware-blocks-webhooks
## whyItBreaks
Webhook senders have no session cookie. Protecting their endpoints returns a Clerk redirect, so every Stripe/UploadThing/Inngest delivery is rejected — the provider retries, then disables the endpoint, and bookings silently stop updating.
## bad
```ts
const isPublic = createRouteMatcher(['/sign-in(.*)']);
```
## good
```ts
const isPublic = createRouteMatcher(['/sign-in(.*)', '/api/webhooks(.*)', '/api/inngest(.*)']);
```
## suggestedFix
Add the machine-to-machine prefixes to the public matcher: `createRouteMatcher(["/api/webhooks(.*)", "/api/uploadthing(.*)", "/api/inngest(.*)", "/.well-known(.*)"])` and let each route verify its own signature.
## commands
```bash
npx @pitcheye/check . --pack clerk
```
```json
{"tool":"explain_rule","arguments":{"ruleId":"clerk/middleware-blocks-webhooks"}}
```