-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Describe the bug
I keep getting Error: no optional dependency [mongodb] defined in peerOptionalDependencies in any package.json. It's so weird because I see it most of the time but no always. Sometimes I can sign in correctly and sometimes I get redirected to /api/auth/signin?error=Callback# and see this error in the client: Try signing with a different account. This is the full error log:
[GET] /api/auth/session
07:12:46:47
2020-08-06T05:12:46.563Z 044494dc-cf2a-4d4d-899c-a8209f59eec8 ERROR [next-auth][error][session_error] Error: no optional dependency [mongodb] defined in peerOptionalDependencies in any package.json
at find_package_json_with_name (/var/task/node_modules/require_optional/index.js:56:11)
at require_optional (/var/task/node_modules/require_optional/index.js:69:13)
at Object.<anonymous> (/var/task/node_modules/next-auth/dist/adapters/typeorm/index.js:118:53)
at Generator.next (<anonymous>)
at asyncGeneratorStep (/var/task/node_modules/next-auth/dist/adapters/typeorm/index.js:28:103)
at _next (/var/task/node_modules/next-auth/dist/adapters/typeorm/index.js:30:194)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
https://next-auth.js.org/errors#session_errorTo Reproduce
My code is in a private repo but if it's necessary I can try to create a new project and replicate it. My code is pretty standard. Just followed the docs. I only have 1 provider (Google) and I've already tried emptying the 3 collections (accounts, users and sessions)
Documentation feedback
Documentation refers to searching through online documentation, code comments and issue history. The example project refers to next-auth-example.
- Found the documentation helpful
- Found documentation but was incomplete
- Could not find relevant documentation
- Found the example project helpful
- Did not find the example project helpful