Clerk gives error but still allows auth to work
Opened this issue · 3 comments
GiraffeCoding commented
I've added the middleware.ts file into the src folder as taken from the blog article:
// middleware.ts
import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";
const isProtectedRoute = createRouteMatcher(["/dashboard(.*)"]);
export default clerkMiddleware((auth, request) => {
if (isProtectedRoute(request)) auth().protect();
});
export const config = {
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
};
The auth seems to work as I'm able to sign in and out with routes also being protected, but I'm getting the following error in the console:
Has anyone else had this error?
MartiinWalsh commented
Hey, what version of @clerk/nextjs
are you using?
GiraffeCoding commented
It installed: 5.0.0-beta.45
MartiinWalsh commented
Not sure if it is related to your issue but 5.0.0-beta.38
was being used in the tutorial. However, Core 2 is now generally available so you can install "@clerk/nextjs": "^5.0.1"