adrianhajdin / threads

Develop Threads, Next.js 13 app that skyrocketed to 100 million sign-ups in less than 5 days, and dethroned giants like Twitter, ChatGPT, and TikTok to become the fastest-growing app ever!
https://threads-psi.vercel.app
1.42k stars 272 forks source link

Error: Clerk: auth() was called but it looks like you aren't using `authMiddleware` in your middleware file. #77

Open krutikbundela opened 9 months ago

krutikbundela commented 9 months ago

Unhandled Runtime Error 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

The middleware.ts is on same level as app image

not able to figureout what is the issue if someone can help tha would be really greatfull

NammDev commented 9 months ago

Did you find solution for this?

MichelHMachado commented 9 months ago

Same problem here. Changed to node 20.1.0 and worked.

Toristeju112 commented 9 months ago

Same problem here. Changed to node 20.1.0 and worked.

Yes, This worked, noticed you have to use the right npm package when working with clerk, some are not compatible with the latest version using version node 18.0.0 will initialize your nextjs but won't work with the api routing and authmiddleware, but when tested on new version (20.1.0) it worked.

Adedayo-Onabamiro commented 9 months ago

i installed (upgraded) node by downloading it from their site, then re ran my project, but it does'nt still work, can anyone provide a more detailed way to resolve this issue? thanks!

Toristeju112 commented 9 months ago

i installed (upgraded) node by downloading it from their site, then re ran my project, but it does'nt still work, can anyone provide a more detailed way to resolve this issue? thanks!

make sure your middleware.ts is at the root directory, then if you are using clerk@latest install nvm i 20.1.0. confirm by checking the node -v , it must be node v - 20.1.0 . check middleware configuration and re run

Adedayo-Onabamiro commented 9 months ago

honestly tried these and still isnt working, have you completed the project? so i could get like a starter file and all ill have to do is npm i

Toristeju112 commented 9 months ago

honestly tried these and still isnt working, have you completed the project? so i could get like a starter file and all ill have to do is npm i

which project exactly? what's your node version, nextjs version and clerk version

Adedayo-Onabamiro commented 9 months ago

the threads project. my node is 20.3.1, my next is 13.5.4 and my clerk is 4.25.2 i used npm and npx to check all these versions, although currently, i copied JSM's package.json, to try to fix my error and did all sorts and it didnt work.

Toristeju112 commented 9 months ago

the threads project. my node is 20.3.1, my next is 13.5.4 and my clerk is 4.25.2 i used npm and npx to check all these versions, although currently, i copied JSM's package.json, to try to fix my error and did all sorts and it didnt work.

the threads project, okay use: Next: 13.4.19 Node: 20.1.0 clerk: 4.25.1

is a more stable version.

Digitl-Alchemyst commented 8 months ago

the threads project. my node is 20.3.1, my next is 13.5.4 and my clerk is 4.25.2 i used npm and npx to check all these versions, although currently, i copied JSM's package.json, to try to fix my error and did all sorts and it didnt work.

the threads project. my node is 20.3.1, my next is 13.5.4 and my clerk is 4.25.2 i used npm and npx to check all these versions, although currently, i copied JSM's package.json, to try to fix my error and did all sorts and it didnt work.

the threads project, okay use: Next: 13.4.19 Node: 20.1.0 clerk: 4.25.1

is a more stable version.

I am running this project as well and here is the versions I am using "@clerk/nextjs": "^4.25.3", "next": "13.5.4", Node: v20.8.0

I was getting the error trying several version combos on this one, my problem was I am using a source folder and had the middleware file in the root dir, once I moved it to the src folder everything worked as expected.

luketas commented 8 months ago

I'm following Antonio's AI companion tutorial and this got me completely stuck.. Tried all the node versions, no idea what will solve this. Anyone had any luck on this particular project? middleware ts is on the same level as the app folder, node v is 20.1.0.. everything seems right.

image image

AniketBajaj2024 commented 6 months ago

I'm following Antonio's AI companion tutorial and this got me completely stuck.. Tried all the node versions, no idea what will solve this. Anyone had any luck on this particular project? middleware ts is on the same level as the app folder, node v is 20.1.0.. everything seems right.

image image

bro have u got the solution?

Stackustack commented 3 months ago

Im stuck on:

node: 20.11.0 clerk: 4.29.9 next: 14.1.3

This is really frustrating. As for now I just disabled authentication by removing the middleware part from /api/uploadthing/core.ts as onUploadComplete doesn't do much with user data anyway. Obviously this is not production ready since it doesn't authenticate the user when uploading stuff... but whatever, its just educational course 👍

This is what you get when you create tutorials with xxx@latests 😮‍💨 if it works at time when @adrianhajdin creates it, it might not work on latest packages 🤷