Preact will cause the mongodb package to not be found?
See original GitHub issueQuestion 💬
When using nextjs with Preact the database part of auth will fail with -
https://next-auth.js.org/errors#oauth_callback_handler_error Error: no optional dependency [mongodb] defined in peerOptionalDependencies in any package.json
at find_package_json_with_name (C:\Users\node_modules\require_optional\index.js:56:11)
at require_optional (C:\Users\node_modules\require_optional\index.js:69:13)
at Object.getAdapter (C:\Users\node_modules\@next-auth\typeorm-legacy-adapter\dist\index.js:104:55)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Object.callback (C:\Users\.next\server\pages\api\auth\[...nextauth].js:5308:42)
I have tried to add the OptionalDependenciesand peerOptionalDependencies but both lead to the same error.
Is this a bug / Indented behaviour ? If so is there a way around it while still using preact? Removing pReact will fix this issue.
EDIT: Looking at previous PR’s seems like this is more of a bug, Here is extra details if required -
System:
OS: Windows 10 10.0.19043
CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
Memory: 17.34 GB / 31.92 GB
Binaries:
Node: 14.17.2 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
npm: 7.21.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.1023.0), Chromium (92.0.902.84)
Internet Explorer: 11.0.19041.906
npmPackages:
@preact/compat: 17.0.2
next: ^11.1.0 => 11.1.0
next-auth: ^3.29.0 => 3.29.0
How to reproduce ☕️
Sandbox - https://codesandbox.io/s/elated-rumple-yu39t
Contributing 🙌🏽
Yes, I am willing to help answer this question in a PR
Issue Analytics
- State:
- Created 2 years ago
- Comments:27 (27 by maintainers)
Top Results From Across the Web
Troubleshooting — MongoDB Manual
These errors indicate that the MongoDB Public GPG key was not added in step Import the public key used by the package management...
Read more >Installing mongoDB issue on ubuntu 20.01
The following packages have unmet dependencies: mongodb-org-database : Depends: mongodb-org-server but it is not going to be installed ...
Read more >How to install mongodb from source code
I would like to know how to build mongodb with source code. ... Invalid MONGO_VERSION '', or could not derive from version.json or...
Read more >Problems installing MongoDB on Ubuntu 20.04
Following the documentation for Mongo 4.4 on Ubuntu, I get the key, add the repository, then get the following error when running atp-get ......
Read more >Error: couldn't connect to server 127.0.0.1:27017 - MongoDB
Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused ... NonExistentPath: Data directory /data/db not found., terminating
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Im down to live on the edge for a while 😃, That PR does seem to fix the SessionProvider issue however it seems like the google provider does not work.
[...nextauth].js
Error
Sign in function
Awesome! Happy to accept a PR that I can check out locally. let’s open a different issue. Sounds like the original problem here is solved! 😊