Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB Adapter: Unsupported BSON version, bson types must be from bson 5.0 or later #7022

Closed
yahavf6 opened this issue Mar 21, 2023 · 2 comments
Labels
adapters Changes related to the core code concerning database adapters mongodb @auth/mongodb-adapter triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@yahavf6
Copy link

yahavf6 commented Mar 21, 2023

Adapter type

@next-auth/mongodb-adapter

Environment

System:
OS: macOS 13.2.1
CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
Memory: 1.80 GB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node
Yarn: 1.22.19 - ~/WebstormProjects/intail-mono/node_modules/.bin/yarn
npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm
Watchman: 2023.03.13.00 - /usr/local/bin/watchman
Browsers:
Chrome: 111.0.5563.64
Safari: 16.3

Reproduction URL

http://localhost:3000

Describe the issue

I have this issue when trying to use the adapter:

[next-auth][error][adapter_error_createUser] 
https://next-auth.js.org/errors#adapter_error_createuser Unsupported BSON version, bson types must be from bson 5.0 or later {
  message: 'Unsupported BSON version, bson types must be from bson 5.0 or later',
  stack: 'BSONVersionError: Unsupported BSON version, bson types must be from bson 5.0 or later\n' +

How to reproduce

Just copy and paste the example from the docs

Expected behavior

To work

@yahavf6 yahavf6 added adapters Changes related to the core code concerning database adapters triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. labels Mar 21, 2023
@github-actions github-actions bot added the mongodb @auth/mongodb-adapter label Mar 21, 2023
@yahavf6
Copy link
Author

yahavf6 commented Mar 21, 2023

I've solved this by downgrading MongoDB to the legacy version.
I think it is important to mention that version 5 is not yet supported.

@ryx
Copy link

ryx commented Dec 16, 2024

I have the same error with the latest combination of mongoose, next-auth, next-auth/email-provder, and mongodb-adapter:

[next-auth][error][adapter_error_createVerificationToken]
https://next-auth.js.org/errors#adapter_error_createverificationtoken Unsupported BSON version, bson types must be from bson 6.x.x {
  message: 'Unsupported BSON version, bson types must be from bson 6.x.x',

It feels somewhat unsatisfying to downgrade to an old mongodb version to have this problem fixed, so maybe the adapter could be upgraded to include a newer mongodb version? Thanks in advance

(sorry for commenting on an old and closed issue, but creating a new ticket is close to impossible without investing serious amounts of time to set up a reproduction repo for this issue, which should be easily understandable by anyone with enough insight -> for reference: #12389 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapters Changes related to the core code concerning database adapters mongodb @auth/mongodb-adapter triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Projects
None yet
Development

No branches or pull requests

2 participants