mah51 / ScuffedMDB

An open-source website to rate movies watched with friends, made with next.js & chakra-ui. Hosted on vercel.com.
https://smdb.mikeroph.one
MIT License
104 stars 15 forks source link

Mongo DB error next auth #69

Open PatelN123 opened 1 year ago

PatelN123 commented 1 year ago

Description

When I tried to deploy mu own version of this, I get this error:

[next-auth][error][adapter_connection_error] 
https://next-auth.js.org/errors#adapter_connection_error MongoError: bad auth : authentication failed
    at MessageStream.messageHandler (/workspace/dashboard/node_modules/mongodb/lib/cmap/connection.js:299:20)
    at MessageStream.emit (node:events:513:28)
    at MessageStream.emit (node:domain:489:12)
    at processIncomingData (/workspace/dashboard/node_modules/mongodb/lib/cmap/message_stream.js:144:12)
    at MessageStream._write (/workspace/dashboard/node_modules/mongodb/lib/cmap/message_stream.js:42:5)
    at writeOrBuffer (node:internal/streams/writable:391:12)
    at _write (node:internal/streams/writable:332:10)
    at MessageStream.Writable.write (node:internal/streams/writable:336:10)
    at TLSSocket.ondata (node:internal/streams/readable:754:22)
    at TLSSocket.emit (node:events:513:28)
    at TLSSocket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at TLSSocket.Readable.push (node:internal/streams/readable:228:10)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
  ok: 0,
  code: 8000,
  codeName: 'AtlasError'
}

Link to Reproduction

No response

Steps to reproduce

No response

Browser

No response

Operating System

Additional Information

No response

mah51 commented 1 year ago

Hi @PatelN123,

Looks like a problem in your mongo uri string in the .env file, can you confirm the password is correct (for the created database user not cloud atlas pass) and didn't leave the angled brackets as stated in this stack overflow: https://stackoverflow.com/questions/55695565/error-message-mongoerror-bad-auth-authentication-failed-through-uri-string

thanks :)

PatelN123 commented 1 year ago

Thanks @mah51,

I managed to get that issue resolved, that was a super silly mistake of mine. However, now I am getting this error:

[next-auth][error][client_fetch_error] 
https://next-auth.js.org/errors#client_fetch_error session FetchError: invalid json response body at https://3000-specianresolv-dashboard-waq2beb8or7.ws-eu80.gitpod.io/api/auth/session reason: Unexpected end of JSON input
    at /workspace/dashboard/node_modules/node-fetch/lib/index.js:273:32
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  type: 'invalid-json'

Please help, thanks.

Nextauth URL is set.