Fix Clerk proxy middleware build

This commit is contained in:
Ishaan (OpenClaw)
2026-02-08 13:38:38 +00:00
parent 6692ed3ba5
commit 4c4d707c32

View File

@@ -15,7 +15,8 @@ export default isClerkEnabled()
? clerkMiddleware(async (auth, req) => {
if (isPublicRoute(req)) return NextResponse.next();
// Clerk typings in App Router return a Promise; keep middleware callback async.
// In middleware, `auth()` resolves to a session/auth context (Promise in current typings).
// Use redirectToSignIn() (instead of protect()) for unauthenticated requests.
const { userId, redirectToSignIn } = await auth();
if (!userId) {
return redirectToSignIn({ returnBackUrl: req.url });