Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Native module is not "context aware" #65

@LubosD

Description

@LubosD

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions