Next.js Discord

Discord Forum

Protected route issue : 'createRouteMatcher' NextJs

Unanswered
Pacific sand lance posted this in #help-forum
Open in Discord
Pacific sand lanceOP
Hello
I can't figure ou what's the issue with my code, because, dashboard still accessible when unauthenticated

import { clerkMiddleware, createRouteMatcher} from '@clerk/nextjs/server' const isProtectedRoute = createRouteMatcher(['/dashboard']); export default clerkMiddleware(async(auth, req) => { if (!isProtectedRoute(req)) await auth.protect() }); Thank you for helping 🙂

0 Replies