Clerk + Next.js: "auth() was called but Clerk can't detect usage of clerkMiddleware()"
@devsingh05▲ 10 net votes
Clerk's server helpers need clerkMiddleware running for that request. Create middleware.ts (src/middleware.ts if you use a src folder) exporting clerkMiddleware(), and make sure its config.matcher includes the route (the default matcher from Clerk's docs covers pages and api routes but skips static files). A middleware file in the wrong folder is silently ignored, which is the usual cause.