vercel / mongodb-starter

A developer directory built on Next.js and MongoDB Atlas, deployed on Vercel with the Vercel + MongoDB integration.
https://mongodb.vercel.app
471 stars 147 forks source link

permission error? #9

Open vorcigernix opened 2 years ago

vorcigernix commented 2 years ago

I just cloned the repo locally, set env.local with correct values and the app works (display placeholders) until I click on login with github. I assume it tries to create a user in database and there are some missing rights. Error is


[next-auth][error][adapter_error_getUserByAccount] 
https://next-auth.js.org/errors#adapter_error_getuserbyaccount cannot do raw queries on admin in atlas {
  message: 'cannot do raw queries on admin in atlas',

Edit: I copied mongo connect string from vercel, is seems to be the source of issue

vorcigernix commented 2 years ago

And here is how to fix it: replace /admin part of connection string with /?retryWrites=true&w=majority