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

fix: MongoError circular dependency #2734

Merged
merged 2 commits into from
Feb 10, 2021
Merged

fix: MongoError circular dependency #2734

merged 2 commits into from
Feb 10, 2021

Conversation

ztomm
Copy link

@ztomm ztomm commented Feb 8, 2021

Bugfix for: "Accessing non-existent property 'MongoError' of module exports inside circular dependency"

Related to https://developer.mongodb.com/community/forums/t/warning-accessing-non-existent-property-mongoerror-of-module-exports-inside-circular-dependency/15411

Description

What changed?

Are there any files to ignore?

@ztomm ztomm changed the title Update options_operation.js fix: MongoError circular dependency Feb 8, 2021
@nbbeeken
Copy link
Contributor

nbbeeken commented Feb 8, 2021

@xkmgt Thanks so much for helping us out with this, testing locally looks like we need to make this same change in lib/operations/operation.js. Are you not seeing the warning emit a stack trace leading to that file? We may need to dig deeper to make sure we catch all the cases where the require calls have this warning.

@ztomm
Copy link
Author

ztomm commented Feb 9, 2021

@nbbeeken you are right. lib/operations/operation.js is the file which causes the circularity.

These files require MongoError and OperationBase at the same time:

const MongoError = require('../core').MongoError;
const OperationBase = require('./operation').OperationBase;
  • lib\operations\bulk_write.js
  • lib\operations\command_v2.js
  • lib\operations\command.js
  • lib\operations\execute_db_admin_command.js
  • lib\operations\execute_operation.js
  • lib\operations\find_and_modify.js
  • lib\operations\find.js
  • lib\operations\insert_many.js
  • lib\operations\insert_one.js
  • lib\operations\map_reduce.js
  • lib\operations\options_operation.js

Changing the path in lib/operations/operation.js solves it. The mod in lib\operations\options_operation.js is unnecessary.

It's running now for some hours in a productive project without any errors. I am happy with it ;-)

@leon
Copy link

leon commented Feb 16, 2021

When can you release a new version containing this?

janober added a commit to n8n-io/n8n that referenced this pull request Feb 18, 2021
This was referenced Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants