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

"Cannot read property 'duration' of undefined" when app receives request #213

Open
kjdelisle opened this issue Nov 4, 2016 · 6 comments · Fixed by #216
Open

"Cannot read property 'duration' of undefined" when app receives request #213

kjdelisle opened this issue Nov 4, 2016 · 6 comments · Fixed by #216
Labels

Comments

@kjdelisle
Copy link
Contributor

kjdelisle commented Nov 4, 2016

Module versions:
[email protected]
[email protected]
[email protected]

Using the [email protected] as my test application, after sending a GET request to the base route of the application, I receive this error:

pid:27864 worker:1 Listening on port: 9082
pid:27864 worker:1 TypeError: Cannot read property 'duration' of undefined
pid:27864 worker:1     at API.<anonymous> (/Users/kevin/.nvm/versions/node/v4.5.0/lib/node_modules/apiconnect-collective-member/node_modules/wlpn/nod
e_modules/wlpn-cli-server/node_modules/strong-supervisor/lib/adapter.js:381:30)
pid:27864 worker:1     at emitOne (events.js:77:13)

pid:27864 worker:1     at API.emit (events.js:169:7)
pid:27864 worker:1     at API.raiseLocalEvent (/Users/kevin/.nvm/versions/node/v4.5.0/lib/node_modules/apiconnect-collective-member/node_modules/wlpn
/node_modules/wlpn-cli-server/node_modules/strong-supervisor/node_modules/appmetrics/appmetrics-api.js:240:7)
pid:27864 worker:1     at Object.module.exports.emit (/Users/kevin/.nvm/versions/node/v4.5.0/lib/node_modules/apiconnect-collective-member/node_modul
es/wlpn/node_modules/wlpn-cli-server/node_modules/strong-supervisor/node_modules/appmetrics/index.js:231:18)
pid:27864 worker:1     at ExpressProbe.metricsEnd (/Users/kevin/.nvm/versions/node/v4.5.0/lib/node_modules/apiconnect-collective-member/node_modules/
wlpn/node_modules/wlpn-cli-server/node_modules/strong-supervisor/node_modules/appmetrics/probes/express-probe.js:89:6)
pid:27864 worker:1     at /Users/kevin/.nvm/versions/node/v4.5.0/lib/node_modules/apiconnect-collective-member/node_modules/wlpn/node_modules/wlpn-cl
i-server/node_modules/strong-supervisor/node_modules/appmetrics/probes/express-probe.js:61:18
pid:27864 worker:1     at args.(anonymous function) (/Users/kevin/.nvm/versions/node/v4.5.0/lib/node_modules/apiconnect-collective-member/node_module
s/wlpn/node_modules/wlpn-cli-server/node_modules/strong-supervisor/node_modules/appmetrics/lib/aspect.js:32:4)
pid:27864 worker:1     at Layer.handle [as handle_request] (/Users/kevin/wlpn/basic/package/node_modules/express/lib/router/layer.js:95:5)
pid:27864 worker:1     at next (/Users/kevin/wlpn/basic/package/node_modules/express/lib/router/route.js:131:13)
@kjdelisle kjdelisle added the bug label Nov 4, 2016
@sam-github
Copy link
Contributor

@tobespc ----^ I haven't reproed, I'll try after looking at some other fires

@sam-github
Copy link
Contributor

It looks like this may have been a bad packaging of apiconnect

@sam-github
Copy link
Contributor

I reopened, because I think #216 is just a work-around, and that something unexpected is happening we need to figure out.

@sjanuary
Copy link

sjanuary commented Nov 7, 2016

I don't see a 'response' in the express data emitted, am I missing something?
https://github.com/RuntimeTools/appmetrics/blob/master/probes/express-probe.js#L82-L89
Perhaps this got rewritten at some point?

@sjanuary
Copy link

sjanuary commented Nov 7, 2016

Yes, it looks like the express probe was refactored at some point. RuntimeTools/appmetrics#260

As long as strong-supervisor is getting all the express data it needs from appmetrics I would say we can just delete that check

i.e. remove the whole of if (probeName === 'express'...
and just have var duration = res.duration;

@sam-github
Copy link
Contributor

supervisor is getting what it needs, but that isn't quite enough. If this is related to RuntimeTools/appmetrics#260, it probably means that the structure of the data is different when the user's app includes https://www.npmjs.com/package/strong-express-metrics, and perhaps that the probe name is wrong? strong-express-metrics is a bit odd, its something that the user manually adds as middleware, and which then sends extra information up the stack: appmetrics -> supervisor -> strong-pm -> strong-arc. Whether its there or not, supervisor should still work.

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

Successfully merging a pull request may close this issue.

3 participants