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

1.7.2 kills express when used with Express v4 Routers #156

Closed
max-degterev opened this issue Jun 17, 2014 · 2 comments
Closed

1.7.2 kills express when used with Express v4 Routers #156

max-degterev opened this issue Jun 17, 2014 · 2 comments

Comments

@max-degterev
Copy link

Hi

After updating to 1.7.1 -> 1.7.2 I have the following issue:

TypeError: Cannot read property 'handle' of null
  at cb_filter (/Users/max/Projects/mp.dev-star/node_modules/newrelic/lib/instrumentation/shared/connect-express.js:135:16)
  at Array.filter (native)
  at Function.cls_wrapMiddlewareStack [as route] (/Users/max/Projects/mp.dev-star/node_modules/newrelic/lib/instrumentation/shared/connect-express.js:128:31)
  at Function.proto.(anonymous function) [as get] (/Users/max/Projects/mp.dev-star/node_modules/express/lib/router/index.js:446:22)
  at RouteFilter.module.exports.Controller._handler (/Users/max/Projects/mp.dev-star/core/javascripts/server/base/controller.coffee:19:5)
  at RouteFilter.module.exports.Controller.get (/Users/max/Projects/mp.dev-star/core/javascripts/server/base/controller.coffee:21:32)
  at RouteFilter.middleware (/Users/max/Projects/mp.dev-star/core/javascripts/server/routefilter.coffee:223:6)
  at RouteFilter.module.exports.Controller.use (/Users/max/Projects/mp.dev-star/core/javascripts/server/base/controller.coffee:29:6)
  at Server.module.exports.Core.modules (/Users/max/Projects/mp.dev-star/core/javascripts/server/index.coffee:69:17)
  at Server.module.exports.Controller.use (/Users/max/Projects/mp.dev-star/core/javascripts/server/base/controller.coffee:30:6)
  at /Users/max/Projects/mp.dev-star/server.coffee:178:12
  at b (domain.js:183:18)
  at Domain.run (domain.js:123:23)
  at Object.<anonymous> (/Users/max/Projects/mp.dev-star/server.coffee:48:10)
  at Object.<anonymous> (/Users/max/Projects/mp.dev-star/server.coffee:4:1)
  at Module._compile (module.js:456:26)

[Tue, 17 Jun 2014 15:15:49 GMT] [app]: Worker 49386 died

Looks like it doesn't play nice with new Express routers, this is our base module class with encapsulated routes:

utils = require('./utils')
_ = require('underscore')
router = require('express').Router()


module.exports = class Controller
  # Please set this on the instance
  logPrefix: '[app.server.base.controller]:'


  # Class logic below
  constructor: (@options)->
    _.extend(@, @options) if @options
    _.extend(@, utils)
    @_router = router

  _handler: (type, route, callbacks...)->
    boundCallbacks = @bind(callbacks)
    @_router[type](route, boundCallbacks...)

  get: (route, callbacks...)-> @_handler('get', route, callbacks...)
  post: (route, callbacks...)-> @_handler('post', route, callbacks...)
  head: (route, callbacks...)-> @_handler('head', route, callbacks...)
  put: (route, callbacks...)-> @_handler('put', route, callbacks...)
  delete: (route, callbacks...)-> @_handler('delete', route, callbacks...)
  all: (route, callbacks...)-> @_handler('all', route, callbacks...)

  use: (@app)->
    @middleware?()
    @modules?()
    @router?()

    @app.use(@_router)

    @log('initialized', 'yellow')
@max-degterev max-degterev changed the title 1.7.2 kills express 1.7.2 kills express when used with Express v4 Routers Jun 17, 2014
@freewil
Copy link

freewil commented Jun 17, 2014

see #154

@txase
Copy link

txase commented Jun 17, 2014

@suprMax Yes, this is a duplicate of issue #154. I'm closing this issue out. We hope to have a fix out very soon. In the meantime, please continue using version 1.7.1.

Thanks!

@txase txase closed this as completed Jun 17, 2014
cmcadams-newrelic pushed a commit to cmcadams-newrelic/node-newrelic that referenced this issue Jan 29, 2024
jsumners-nr pushed a commit to jsumners-nr/node-newrelic that referenced this issue Apr 16, 2024
chore: added node 20 and drop node 14 in CI
bizob2828 added a commit to bizob2828/node-newrelic that referenced this issue Apr 19, 2024
update actions that are using deprecated node 12
bizob2828 added a commit to bizob2828/node-newrelic that referenced this issue Apr 23, 2024
update actions that are using deprecated node 12
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

3 participants