Clerk auth middleware error when deploying to Vercel

34 Views Asked by At

This error appears only when deploying to Vercel, the code works fine locally with no changes:

Error: Clerk: auth() was called but Clerk can't detect usage of clerkMiddleware() (or the deprecated authMiddleware())

My middleware looks like this, which is in my root folder:

import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";

export default clerkMiddleware(() => {});

export const config = {
  matcher: ["/((?!.*\\..*|_next).*)", "/", "/translate", "/(api|trpc)(.*)"],
};

I'm sure it's not deprecated because I'm using their beta https://clerk.com/changelog/2024-02-29-core-2

0

There are 0 best solutions below