Skip to content

Commit 2ee7aba

Browse files
committed
fix: correct Clerk auth.protect() usage in middleware
The auth parameter in clerkMiddleware is of type AuthFn, which has protect() as a direct method. No need to call auth() first. Changed: await auth().protect() → await auth.protect() This fixes TypeScript error: Property 'protect' does not exist on type 'Promise<SessionAuthWithRedirect>' Verified with: npm run typecheck (passes cleanly)
1 parent 79844d2 commit 2ee7aba

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

frontend/src/middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default clerkMiddleware(async (auth, req) => {
1919

2020
// Enforce authentication for protected routes
2121
// This will redirect unauthenticated users to the sign-in page
22-
await auth().protect();
22+
await auth.protect();
2323

2424
return NextResponse.next();
2525
});

0 commit comments

Comments
 (0)