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!

Home Page:https://threads-psi.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: Failed to create/update user: Plan executor error during findAndModify :: caused by :: E11000 duplicate key error collection: test.users index: userName_1 dup key: { userName: null }

Mishael-Joe opened this issue · comments

can i resolve this issue

I tried changing updateUser method from user actions and trying to find any mistakes in AccountProfile, but what solved my problem was deleting the collections from mongodb. (You can also delete the users from clerk in order to reuse your email)
In my case I had my mongoose user schema variable set as userName instead of all lowercase username. I decided to change it half way to username but because the db already had a user collection with userName, it was not allowing me to create / update. Hopefully this will help any of those who encounter this error.

Screenshot 2024-01-12 at 21 17 50

Thanks 👍