From 0fe9d8f79accf1cb00aa387b190bb25cb0e60714 Mon Sep 17 00:00:00 2001 From: Kunal Date: Sat, 7 Feb 2026 20:43:14 +0000 Subject: [PATCH] fix(frontend): await auth() in clerkMiddleware callback --- frontend/src/proxy.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/src/proxy.ts b/frontend/src/proxy.ts index 29c99a5a..dc3a8635 100644 --- a/frontend/src/proxy.ts +++ b/frontend/src/proxy.ts @@ -12,12 +12,11 @@ const isClerkEnabled = () => const isPublicRoute = createRouteMatcher(["/sign-in(.*)"]); export default isClerkEnabled() - ? clerkMiddleware((auth, req) => { + ? clerkMiddleware(async (auth, req) => { if (isPublicRoute(req)) return NextResponse.next(); - // Clerk typings in App Router return SessionAuthWithRedirect. - // Use redirectToSignIn() instead of protect(). Keep middleware callback sync. - const { userId, redirectToSignIn } = auth(); + // Clerk typings in App Router return a Promise; keep middleware callback async. + const { userId, redirectToSignIn } = await auth(); if (!userId) { return redirectToSignIn({ returnBackUrl: req.url }); }