fix(frontend): call auth().protect() in Clerk middleware

This commit is contained in:
Kunal
2026-02-07 19:41:37 +00:00
parent 9184ebed25
commit fce12698d8

View File

@@ -14,8 +14,8 @@ const isPublicRoute = createRouteMatcher(["/sign-in(.*)"]);
export default isClerkEnabled()
? clerkMiddleware(async (auth, req) => {
if (isPublicRoute(req)) return NextResponse.next();
const session = await auth();
session.protect();
// Clerk middleware auth object supports protect() directly.
auth().protect();
return NextResponse.next();
})
: () => NextResponse.next();