Clerk middleware error
Unanswered
Rhinelander posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
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
![Avatar](https://cdn.discordapp.com/avatars/678259999201427466/1936f7e8963ff0f800f5eb4b43bc833c.webp?size=256)
Clown
middleware must be in the same folder as your package.json
Or inside src folder if you use that
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
RhinelanderOP
it is
![Avatar](https://cdn.discordapp.com/avatars/678259999201427466/1936f7e8963ff0f800f5eb4b43bc833c.webp?size=256)
Clown
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)(.*)'],
};
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
RhinelanderOP
yes
![Avatar](https://cdn.discordapp.com/avatars/678259999201427466/1936f7e8963ff0f800f5eb4b43bc833c.webp?size=256)
Clown
Try logging to the console with the middleware
To confirm it works
Check browser logs and console logs to see if there is anything
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
RhinelanderOP
nothing
i was reading about it
it may be clerk bug
bug that clerk's dev team made
![Avatar](https://cdn.discordapp.com/avatars/678259999201427466/1936f7e8963ff0f800f5eb4b43bc833c.webp?size=256)
Clown
Welp, then you'll have to follow up there
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
RhinelanderOP
![Image](https://cdn.discordapp.com/attachments/1160957683508203561/1160989722659799040/image.png?ex=6536aaf0&is=652435f0&hm=2c90400fc71be48514d4bc4275caa90281fc5fa5fd30324431b94e8caff68905&)
![Avatar](https://cdn.discordapp.com/avatars/678259999201427466/1936f7e8963ff0f800f5eb4b43bc833c.webp?size=256)
Clown
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 update![Avatar](https://cdn.discordapp.com/avatars/839454110302732309/d3f0b9db767484084f52339f0b4f2385.webp?size=256)
dumbboy
Github 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?
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
RhinelanderOP
sure i can try just give me a min
update does not work and i don't find cookies:)