-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
None
From github: https://github.com/mongodb-js/bson-ext/issues/45
When using the new experimental worker threads in Node 10.5 and above, if you require bson-ext in both the parent and the worker, the following error is thrown:
{{Error: Module did not self-register.
at Object.Module._extensions..node (internal/modules/cjs/loader.js:718:18)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at bindings (/Users/matt.olson/workspace/storefront-renderer/node_modules/bindings/bindings.js:81:44)
at Object.<anonymous> (/Users/matt.olson/workspace/storefront-renderer/node_modules/bson-ext/lib/index.js:1:93)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)}}This seems to be related to nodejs/node#21783 and nodejs/node#21481. I believe the issue is that the module needs to be context-aware.
I ran into a similar issue with the lzo package and have a PR open for it. We will need to do something similar here.