Clerk middleware error
Unanswered
Rhinelander posted this in #help-forum
RhinelanderOP
I don't really know what to do. I copy pasted middleware from clerk and my dashboard looks just fine
JS ⨯ node_modules\@clerk\nextjs\dist\esm\server\getAuth.js (28:12) @ eval
⨯ Error: Clerk: auth() was called but it looks like you aren't using `authMiddleware` in your middleware file. Please use `authMiddleware` and make sure your middleware matcher is configured correctly and it matches this route or page. See https://clerk.com/docs/quickstarts/get-started-with-nextjs
at DashboardLayout ([subjectId]/layout.tsx:18:75)
at async Promise.all (index 0)
at async Promise.all (index 0)
digest: "203805"
null
22 Replies
middleware must be in the same folder as your package.json
Or inside src folder if you use that
RhinelanderOP
it is
If this is your "middleware.ts":
import { authMiddleware } from "@clerk/nextjs";
// This example protects all routes including api/trpc routes
// Please edit this to allow other routes to be public as needed.
// See https://clerk.com/docs/references/nextjs/auth-middleware for more information about configuring your middleware
export default authMiddleware({});
export const config = {
matcher: ['/((?!.+\\.[\\w]+$|_next).*)', '/', '/(api|trpc)(.*)'],
};
RhinelanderOP
yes
Try logging to the console with the middleware
To confirm it works
Check browser logs and console logs to see if there is anything
RhinelanderOP
nothing
i was reading about it
it may be clerk bug
bug that clerk's dev team made
Welp, then you'll have to follow up there
RhinelanderOP
Try checking that link to modify that middleware and a console log in it to see if it even works
If it doesnt, then its better to follow up on clerk itself
If a new version dropped you will have to use
npm update
to make it updateGithub Issue related to this: https://github.com/clerkinc/clerk-next-app-router-starter/issues/2
Just incase if you are able to find any solutions
@Rhinelander can you try clearing cookies?
RhinelanderOP
sure i can try just give me a min
update does not work and i don't find cookies:)