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

Error: Module did not self-register #258

Closed
frankda opened this issue Jun 19, 2024 · 5 comments
Closed

Error: Module did not self-register #258

frankda opened this issue Jun 19, 2024 · 5 comments
Labels
bug needs-repro Needs a reproduction case for further investigation

Comments

@frankda
Copy link

frankda commented Jun 19, 2024

Description

Hi I got error:

✖ Error: Module did not self-register: '/Users/[project-root]/node_modules/@newrelic/native-metrics/prebuilds/darwin-arm64/@newrelic+native-metrics.abi115.uv1.armv8.glibc.node'.

After upgrade node version from 16 to 20. Tried npm rebuild but doesn't work. According to this post nodejs/node#21783 (comment), it might resolve this issue. Could you please consider update according to this post?

Meanwhile, I will try to pull and build the module myself with solution and see if it can fix this issue.

Expected Behavior

Sorry I cannot provide more information as I am new to newrelic and I don't know how to reproduce with a minimal reproducible example.

Troubleshooting or NR Diag results

Steps to Reproduce

Your Environment

  • ex: Node version: 20.11.1
  • ex: Operating System and version:
    System Version: macOS 14.2 (23C64)
    Kernel Version: Darwin 23.2.0

Additional context

@workato-integration
Copy link

@mrickard
Copy link
Member

Thank you for reporting this, @frankda . Would you be able to provide us with a repro case with which we can test?

@mrickard mrickard added needs-repro Needs a reproduction case for further investigation and removed needs-triage labels Jun 20, 2024
@frankda
Copy link
Author

frankda commented Jun 24, 2024

Thank you for reporting this, @frankda . Would you be able to provide us with a repro case with which we can test?

Please find this repo https://github.com/frankda/newrelic-native-metrics-context-aware-example for minimal reproducible example when use @newrelic/native-metrics in multiple node worker thread. Will get Error: Module did not self-register

We encounter this issue when using native-metrics with serverless framework and serverless-offline plugin. Don't have this issue with node v16 and older version of serverless. I suspect newer serverless-offline is using worker thread and native-metrics is not context aware.

To fix this, can update https://github.com/newrelic/node-native-metrics/blob/main/src/native_metrics.cpp#L20 to

NODE_MODULE_INIT() {
    Init(exports);
}

I can create a PR for this if needed

@mrickard
Copy link
Member

You're certainly welcome to open a PR, though I should note that we don't recommend enabling the native metrics plugin when operating in Serverless Mode, and as of v11, we don't recommend running the agent in worker threads.

@bizob2828
Copy link
Member

I'm going to close this based on @mrickard comments. However, @frankda feel free to open PR to address your suggestion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs-repro Needs a reproduction case for further investigation
Projects
Archived in project
Development

No branches or pull requests

3 participants