Clerk middleware error
Unanswered
arnez posted this in #help-forum
![Avatar](https://cdn.discordapp.com/avatars/906905917742780439/4872936c7445809a2f28dc5675b1cb65.webp?size=256)
arnezOP
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/54265510de155a7d7909e4d21d587a76.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/avatars/906905917742780439/4872936c7445809a2f28dc5675b1cb65.webp?size=256)
arnezOP
it is
![Avatar](https://cdn.discordapp.com/avatars/678259999201427466/54265510de155a7d7909e4d21d587a76.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/avatars/906905917742780439/4872936c7445809a2f28dc5675b1cb65.webp?size=256)
arnezOP
yes
![Avatar](https://cdn.discordapp.com/avatars/678259999201427466/54265510de155a7d7909e4d21d587a76.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/avatars/906905917742780439/4872936c7445809a2f28dc5675b1cb65.webp?size=256)
arnezOP
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/54265510de155a7d7909e4d21d587a76.webp?size=256)
Clown
Welp, then you'll have to follow up there
![Avatar](https://cdn.discordapp.com/avatars/906905917742780439/4872936c7445809a2f28dc5675b1cb65.webp?size=256)
arnezOP
![Image](https://cdn.discordapp.com/attachments/1160957683508203561/1160989722659799040/image.png?ex=6536aaf0&is=652435f0&hm=2c90400fc71be48514d4bc4275caa90281fc5fa5fd30324431b94e8caff68905&)
![Avatar](https://cdn.discordapp.com/avatars/678259999201427466/54265510de155a7d7909e4d21d587a76.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
@arnez can you try clearing cookies?
![Avatar](https://cdn.discordapp.com/avatars/906905917742780439/4872936c7445809a2f28dc5675b1cb65.webp?size=256)
arnezOP
sure i can try just give me a min
update does not work and i don't find cookies:)