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: Cannot read property 'handler' of undefined #90

Closed
fxkjd opened this issue Dec 9, 2013 · 9 comments
Closed

Error: Cannot read property 'handler' of undefined #90

fxkjd opened this issue Dec 9, 2013 · 9 comments

Comments

@fxkjd
Copy link

fxkjd commented Dec 9, 2013

Hi!, I'm getting this error in my new relic logs, looks like it's coming from the new relic library.
Stack trace:

 TypeError: Cannot read property 'handler' of undefined
at formatContent (/usr/local/lib/node_modules/geddy/lib/response/index.js:58:21)
at controller.BaseController.respond (/usr/local/lib/node_modules/geddy/lib/controller/base_controller.js:558:14)
at Promise.<anonymous> (/home/bpop/bepopu/app/controllers/users.js:275:27)
at Promise.<anonymous> (/home/bpop/bepopu/node_modules/mongoose/node_modules/mpromise/lib/promise.js:171:8)
at Promise.EventEmitter.emit (events.js:95:17)
at Promise.emit (/home/bpop/bepopu/node_modules/mongoose/node_modules/mpromise/lib/promise.js:88:38)
at Promise.fulfill (/home/bpop/bepopu/node_modules/mongoose/node_modules/mpromise/lib/promise.js:101:20)
at Promise.resolve (/home/bpop/bepopu/node_modules/mongoose/lib/promise.js:108:15)
at /home/bpop/bepopu/node_modules/mongoose/lib/model.js:2011:23
at /home/bpop/bepopu/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31

Using node v0.10.22

Any ideas?

Thanks!

@groundwater
Copy link
Contributor

Hi @ke2g, thanks for taking the time to submit your error here.

I would like to look into this more, but I may need some more information. Can you provide your exact list of dependencies and versions via npm list.

Second, can you email the newrelic_agent.log file to [email protected] .

I should mention that due to how the newrelic module works, it will almost-always appear in your stack traces. I am not precluding the possibility of the agent doing something errant here however.

I will investigate, thanks!

wraithan pushed a commit that referenced this issue May 15, 2014
agent: reset error count at end of harvest cycle regardless of error collector settings
@marcbachmann
Copy link

Hello,
I also get the same error. This happens when some routes get initialized after other routes.
I don't have the problem when removing the newrelic module.

Here is a better stacktrace:

/app/node_modules/newrelic/lib/instrumentation/shared/connect-express.js:135
          if (m.handle !== sentinel) {
               ^
TypeError: Cannot read property 'handle' of null
  at cb_filter (/app/node_modules/newrelic/lib/instrumentation/shared/connect-express.js:135:16)
  at Array.filter (native)
  at Function.cls_wrapMiddlewareStack [as route] (/app/node_modules/newrelic/lib/instrumentation/shared/connect-express.js:128:31)
  at Function.proto.(anonymous function) [as get] (/app/node_modules/express/lib/router/index.js:446:22)
  at [object Object].<anonymous> (/app/index.coffee:10:10)
  at [object Object]._onTimeout (/app/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31)
  at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

Demo

index.coffee

require('coffee-script/register')
require('newrelic')
express = require('express')
router = express.Router()
router.get '/test', (req, res, next) ->
  console.log('test')
  next()

setTimeout ->
  router.get '/test', (req, res, next) ->
    console.log('test')
    next()
, 2000

doing the same using express() works

require('coffee-script/register')
require('newrelic')
express = require('express')
router = express()
router.get '/test', (req, res, next) ->
  console.log('test')
  next()

setTimeout ->
  router.get '/test', (req, res, next) ->
    console.log('test')
    next()
, 2000

@txase
Copy link

txase commented Jun 16, 2014

@marcbachmann I copied your second script into a file app.coffee. I then compiled it into app.js using the coffee-script coffee binary. I copied in a newrelic.js config file, and installed newrelic. I then ran the script and nothing blew up. Is there anything else we need to do to exhibit the behavior?

Thanks!

@marcbachmann
Copy link

Yes, the the first script is using the new Router api from express 4 which is not working.
The second script only show that it's working using the api from express 3.

@txase
Copy link

txase commented Jun 16, 2014

@marcbachmann Ahh, I misread what you wrote. I too can reproduce the issue now. We'll work on a fix.

Thanks!

@marcbachmann
Copy link

@txase No problem. Thank you.
I've just seen that this is not the same problem like in the first comment.
You probably want to create a new issue for that.

@txase
Copy link

txase commented Jun 16, 2014

@marcbachmann good catch. Please open a new issue for us.

Thanks!

@marcbachmann
Copy link

Created here: #155
I think this issue can be closed.
The error in the first comment has most certainly nothing to do with the newrelic module.

@txase
Copy link

txase commented Jun 26, 2014

Hi @ke2g,

We believe we have resolved your issue in the latest release of the Node.js agent. Please try it out.

I am closing this issue now, but please feel free to reopen if you continue to have issues. Thanks!

@txase txase closed this as completed Jun 26, 2014
cmcadams-newrelic pushed a commit to cmcadams-newrelic/node-newrelic that referenced this issue Jan 29, 2024
…mock-infinite-tracing-server/protobufjs-7.2.4

chore(deps): bump protobufjs from 7.2.3 to 7.2.4 in /mock-infinite-tracing-server
jsumners-nr pushed a commit to jsumners-nr/node-newrelic that referenced this issue Apr 11, 2024
…moment-2.29.4

Bump moment from 2.29.2 to 2.29.4
jsumners-nr pushed a commit to jsumners-nr/node-newrelic that referenced this issue Apr 16, 2024
bizob2828 added a commit to bizob2828/node-newrelic that referenced this issue Apr 19, 2024
bizob2828 added a commit to bizob2828/node-newrelic that referenced this issue Apr 23, 2024
bizob2828 added a commit to bizob2828/node-newrelic that referenced this issue Jul 26, 2024
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

No branches or pull requests

4 participants