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

UnhandledPromiseRejectionWarning: Error: cyclic dependency detected #292

Closed
JoaoBM1 opened this issue Jun 12, 2018 · 4 comments
Closed

UnhandledPromiseRejectionWarning: Error: cyclic dependency detected #292

JoaoBM1 opened this issue Jun 12, 2018 · 4 comments

Comments

@JoaoBM1
Copy link

JoaoBM1 commented Jun 12, 2018

Hey!

Im currently running into a "UnhandledPromiseRejectionWarning: Error: cyclic dependency detected" when setting up connect-mongo.

Here is my current code:

var session = require("express-session");
var MongoStore = require('connect-mongo')(session);

mongoose.connect("mongodb+srv://x:x@cluster0-anqkh.mongodb.net/H2Oil?retryWrites=true");

app.use(session({
  secret: 'keyboard cat',
  resave: false,
  store: new MongoStore({ mongooseConnection: mongoose.connection }),
  saveUninitialized: false
}));

As for the error logged in the console:

(node:11984) UnhandledPromiseRejectionWarning: Error: cyclic dependency detected
at serializeObject (C:\Users\João\Desktop\GitHub\Web_Project_F-J\node_modules\bson\lib\bson\parser\serializer.js:331:34)
at serializeInto (C:\Users\João\Desktop\GitHub\Web_Project_F-J\node_modules\bson\lib\bson\parser\serializer.js:934:17)
at serializeObject (C:\Users\João\Desktop\GitHub\Web_Project_F-J\node_modules\bson\lib\bson\parser\serializer.js:345:18)
at serializeInto (C:\Users\João\Desktop\GitHub\Web_Project_F-J\node_modules\bson\lib\bson\parser\serializer.js:934:17)
at serializeObject (C:\Users\João\Desktop\GitHub\Web_Project_F-J\node_modules\bson\lib\bson\parser\serializer.js:345:18)
at serializeInto (C:\Users\João\Desktop\GitHub\Web_Project_F-J\node_modules\bson\lib\bson\parser\serializer.js:934:17)
at serializeObject (C:\Users\João\Desktop\GitHub\Web_Project_F-J\node_modules\bson\lib\bson\parser\serializer.js:345:18)
at serializeInto (C:\Users\João\Desktop\GitHub\Web_Project_F-J\node_modules\bson\lib\bson\parser\serializer.js:934:17)
at serializeObject (C:\Users\João\Desktop\GitHub\Web_Project_F-J\node_modules\bson\lib\bson\parser\serializer.js:345:18)
at serializeInto (C:\Users\João\Desktop\GitHub\Web_Project_F-J\node_modules\bson\lib\bson\parser\serializer.js:934:17)
at serializeObject (C:\Users\João\Desktop\GitHub\Web_Project_F-J\node_modules\bson\lib\bson\parser\serializer.js:345:18)
at serializeInto (C:\Users\João\Desktop\GitHub\Web_Project_F-J\node_modules\bson\lib\bson\parser\serializer.js:934:17)
at serializeObject (C:\Users\João\Desktop\GitHub\Web_Project_F-J\node_modules\bson\lib\bson\parser\serializer.js:345:18)
at serializeInto (C:\Users\João\Desktop\GitHub\Web_Project_F-J\node_modules\bson\lib\bson\parser\serializer.js:934:17)
at serializeObject (C:\Users\João\Desktop\GitHub\Web_Project_F-J\node_modules\bson\lib\bson\parser\serializer.js:345:18)
at serializeInto (C:\Users\João\Desktop\GitHub\Web_Project_F-J\node_modules\bson\lib\bson\parser\serializer.js:934:17)
(node:11984) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11984) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Hope you can help. Thanks!

@adriantombu
Copy link

Same problem here since I switched to a mongodb+srv:// URI.

When I switch back to my old connexion in mongodb:// I don't get this error

@Seltiix
Copy link

Seltiix commented Jun 21, 2018

Has anyone found a solution to this problem?

EDIT: I found that removing retryWrites=true fixed the issue for me

@mingchuno
Copy link
Collaborator

from mongodb doc:

The MongoDB version of every node in the cluster must be 3.6 or greater, and the featureCompatibilityVersion of each node in the cluster must be 3.6 or greater.

In the time of your writing, this library is not yet support mongodb 3.6.
We have added MongoDB 3.6 support in lastest commit and still waiting to publish

@stale
Copy link

stale bot commented Jun 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants