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

Native module is not "context aware" #65

Closed
LubosD opened this issue Sep 2, 2024 · 0 comments · Fixed by #66
Closed

Native module is not "context aware" #65

LubosD opened this issue Sep 2, 2024 · 0 comments · Fixed by #66

Comments

@LubosD
Copy link

LubosD commented Sep 2, 2024

Hello,

I'm porting a codebase from browser to Node.js and I'm facing the requirement of synchronous XHR requests in Workers, which sync-request-curl seems to solve.

The problem is that I need to load this package in multiple workers, which currently crashes:

ERR Error: Module did not self-register: '/home/lubos/dedicaid/DicomCdssHandler/node_modules/easy-libcurl/lib/binding/node_libcurl.node'.
    at Object..node (node:internal/modules/cjs/loader:1544:18)
    at Module.load (node:internal/modules/cjs/loader:1249:32)
    at Function._load (node:internal/modules/cjs/loader:1065:12)
    at Module.require (node:internal/modules/cjs/loader:1271:19)
    at require (node:internal/modules/helpers:123:16)
    at Object.<anonymous> (/home/lubos/dedicaid/DicomCdssHandler/node_modules/easy-libcurl/dist/Easy.js:5:18)
    at Module._compile (node:internal/modules/cjs/loader:1434:14)
    at Object..js (node:internal/modules/cjs/loader:1518:10)
    at Module.load (node:internal/modules/cjs/loader:1249:32)
    at Function._load (node:internal/modules/cjs/loader:1065:12) {
  code: 'ERR_DLOPEN_FAILED'
}

It seems that the problem is that native modules need to be made context aware. I think the fix could be as simple as replacing NODE_MODULE with NAN_MODULE_WORKER_ENABLED.

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 a pull request may close this issue.

1 participant