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

Errors with Node 8: am.emit is not a function (using both appmetrics-dash and appmetrics-prometheus) #124

Open
a-roberts opened this issue Nov 27, 2017 · 3 comments
Labels

Comments

@a-roberts
Copy link

a-roberts commented Nov 27, 2017

Application crashes immediately after startup.

/home/aroberts/design-for-cloud/node_modules/appmetrics-dash/node_modules/appmetrics/probes/socketio-probe.js:140
    am.emit('socketio', {
       ^

TypeError: am.emit is not a function
    at SocketioProbe.metricsEnd (/home/aroberts/design-for-cloud/node_modules/appmetrics-dash/node_modules/appmetrics/probes/socketio-probe.js:140:8)
    at /home/aroberts/design-for-cloud/node_modules/appmetrics-dash/node_modules/appmetrics/probes/socketio-probe.js:51:14
    at Namespace.newFunc [as emit] (/home/aroberts/design-for-cloud/node_modules/appmetrics-dash/node_modules/appmetrics/lib/aspect.js:83:14)
    at Server.(anonymous function) [as emit] (/home/aroberts/design-for-cloud/node_modules/appmetrics-dash/node_modules/socket.io/lib/index.js:456:29)
    at Timeout.emitData [as _onTimeout] (/home/aroberts/design-for-cloud/node_modules/appmetrics-dash/lib/appmetrics-dash.js:439:8)
    at ontimeout (timers.js:469:11)

No problems on 6.12.0. Happens regardless of import order, package.json features

  "dependencies": {
    "appmetrics-dash": "^3.3.2",
    "appmetrics-prometheus": "^0.0.2",

The application itself is a Bluemix web starter for Node.js so should be an easy recreate, start a basic Express server with

require('appmetrics-dash').attach();
require('appmetrics-prometheus').attach();

the order of the imports doesn't matter in this case either. IBMers can ping me for the code (it's at github.ibm.com).

@sjanuary
Copy link
Contributor

@a-roberts I don't see this error in my test project running on Node 8 with the same two requires. I'll get the source code from you offline and see what the difference is.

@sjanuary
Copy link
Contributor

This issue turned out to be a clash between 2 installs of appmetrics when using both appmetrics-dash and appmetrics-prometheus. It will be fixed in the next appmetrics release, but a workaround is to make sure that you only have one copy of appmetrics in your node_modules directory so that there is no clash.

@sjanuary sjanuary changed the title Errors with Node 8: am.emit is not a function Errors with Node 8: am.emit is not a function (using both appmetrics-dash and appmetrics-prometheus) Nov 29, 2017
@sjanuary sjanuary added the bug label Nov 29, 2017
@dcowden
Copy link

dcowden commented May 4, 2018

@a-roberts I found this issue because i'm also using both appmetrics-dash and appmetrics-prometheus. I'm trying to find out how to run them both, but using a separate server vs attaching to the main process. Do you know how to do that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants