newrelic / node-newrelic

New Relic Node.js agent code base. Developers are welcome to create pull requests here, please see our contributing guidelines. For New Relic technical support, please go to http://support.newrelic.com.
Apache License 2.0
971 stars 399 forks source link

Cannot call method 'handle' of undefined #160

Closed groundwater closed 10 years ago

groundwater commented 10 years ago

From @oblador in #154

Still getting similar errors, but not on startup – only when requesting a page.

Using latest krakenjs which might complicate debugging, but doesn't seem to be involved judging by the stack trace.

TypeError: Cannot call method 'handle' of undefined
    at Function.app.handle (<project path>/node_modules/express/lib/application.js:124:16)
    at Layer.fn (<project path>/node_modules/express/lib/application.js:188:17)
    at Layer.eval [as handle] (eval at wrapHandle (<project path>/node_modules/newrelic/lib/instrumentation/express.js:246:41), <anonymous>:10:14)
    at trim_prefix (<project path>/node_modules/express/lib/router/index.js:252:17)
    at <project path>/node_modules/express/lib/router/index.js:216:9
    at Function.proto.process_params (<project path>/node_modules/express/lib/router/index.js:284:12)
    at Function.cls_wrapProcessParams [as process_params] (<project path>/node_modules/newrelic/lib/instrumentation/express.js:185:29)
    at next (<project path>/node_modules/express/lib/router/index.js:207:19)
    at next (<project path>/node_modules/express/lib/router/index.js:182:38)
    at <project path>/node_modules/newrelic/node_modules/continuation-local-storage/context.js:76:17
groundwater commented 10 years ago

It looks like the error is coming out of express this time, but there's always a chance the agent has patched something incorrectly.

A few quick questions:

  1. does this error always occur?
  2. does it still occur when you remove the newrelic module?
  3. can you provide the exact versions of all your dependencies via npm shrinkwrap

If we can reproduce this error, and verify that it's coming out of our module, it's usually a quick fix.

Thanks!

oblador commented 10 years ago

Yes, only occurs when including the newrelic module. Will reply with reproducible case asap.

oblador commented 10 years ago

OK, install kraken generator with npm install -g yo generator-kraken, scaffold a new project with yo kraken, start with npm start. Works fine.

Add newrelic 1.7.3 with npm install newrelic, add require('newrelic’); to the beginning of index.js. And I get the error above. Did not happen before express 4.

My newrelic.js:

var appName = process.env.NEW_RELIC_APP_NAME || process.env.APP_NAME;
var env = process.env.NODE_ENV || 'development';

if(!appName) {
  var path = require('path');
  appName = path.basename(__dirname);
}

if(env !== 'production') {
  appName += '-' + env;
}

exports.config = {
  /**
   * Array of application names.
   */
  app_name : [appName],
  /**
   * Your New Relic license key.
   */
  license_key : process.env.NEW_RELIC_LICENSE_KEY,
  feature_flag: {
    express4: true
  },
  logging : {
    /**
     * Level at which to log. 'trace' is most useful to New Relic when diagnosing
     * issues with the agent, 'info' and higher will impose the least overhead on
     * production applications.
     */
    level : process.env.NEW_RELIC_LOG_LEVEL || 'trace'
  }
};

npm-shrinkwrap.json:

{
  "name": "newrelic-bug",
  "version": "0.1.0",
  "dependencies": {
    "kraken-js": {
      "version": "1.0.1",
      "from": "kraken-js@^1.0.1",
      "dependencies": {
        "caller": {
          "version": "0.0.1",
          "from": "caller@~0.0.1",
          "dependencies": {
            "tape": {
              "version": "2.3.3",
              "from": "tape@~2.3.2",
              "dependencies": {
                "jsonify": {
                  "version": "0.0.0",
                  "from": "jsonify@~0.0.0"
                },
                "deep-equal": {
                  "version": "0.1.2",
                  "from": "deep-equal@~0.1.0"
                },
                "defined": {
                  "version": "0.0.0",
                  "from": "defined@~0.0.0"
                },
                "through": {
                  "version": "2.3.4",
                  "from": "through@~2.3.4"
                },
                "resumer": {
                  "version": "0.0.0",
                  "from": "resumer@~0.0.0"
                },
                "inherits": {
                  "version": "2.0.1",
                  "from": "inherits@~2.0.1"
                }
              }
            }
          }
        },
        "meddleware": {
          "version": "1.0.0",
          "from": "meddleware@^1.0.0"
        },
        "shortstop-handlers": {
          "version": "1.0.0",
          "from": "shortstop-handlers@^1.0.0",
          "dependencies": {
            "glob": {
              "version": "3.2.11",
              "from": "glob@^3.2.9",
              "dependencies": {
                "inherits": {
                  "version": "2.0.1",
                  "from": "inherits@2"
                },
                "minimatch": {
                  "version": "0.3.0",
                  "from": "minimatch@0.3",
                  "dependencies": {
                    "lru-cache": {
                      "version": "2.5.0",
                      "from": "lru-cache@2"
                    },
                    "sigmund": {
                      "version": "1.0.0",
                      "from": "sigmund@~1.0.0"
                    }
                  }
                }
              }
            }
          }
        },
        "endgame": {
          "version": "0.0.3",
          "from": "endgame@^0.0.3"
        },
        "debuglog": {
          "version": "0.0.4",
          "from": "debuglog@~0.0.2"
        },
        "shush": {
          "version": "0.0.1",
          "from": "shush@~0.0.1",
          "dependencies": {
            "strip-json-comments": {
              "version": "0.1.3",
              "from": "strip-json-comments@~0.1.1"
            }
          }
        },
        "lusca": {
          "version": "1.0.1",
          "from": "lusca@^1.0.0",
          "resolved": "https://registry.npmjs.org/lusca/-/lusca-1.0.1.tgz"
        },
        "express-enrouten": {
          "version": "1.1.1",
          "from": "express-enrouten@^1.0.0",
          "dependencies": {
            "debuglog": {
              "version": "1.0.1",
              "from": "debuglog@^1.0.1"
            },
            "reverend": {
              "version": "0.2.0",
              "from": "reverend@^0.2.0",
              "dependencies": {
                "path-to-regexp": {
                  "version": "0.1.2",
                  "from": "path-to-regexp@^0.1.2"
                }
              }
            }
          }
        },
        "core-util-is": {
          "version": "1.0.1",
          "from": "core-util-is@^1.0.1"
        },
        "formidable": {
          "version": "1.0.15",
          "from": "formidable@^1.0.14"
        },
        "shortstop": {
          "version": "1.0.1",
          "from": "shortstop@^1.0.0",
          "resolved": "https://registry.npmjs.org/shortstop/-/shortstop-1.0.1.tgz",
          "dependencies": {
            "async": {
              "version": "0.2.10",
              "from": "async@~0.2.10"
            }
          }
        },
        "confit": {
          "version": "1.2.0",
          "from": "confit@^1.1.0",
          "dependencies": {
            "minimist": {
              "version": "0.0.10",
              "from": "minimist@~0.0.8"
            },
            "debuglog": {
              "version": "1.0.1",
              "from": "debuglog@^1.0.1"
            },
            "shortstop-handlers": {
              "version": "0.1.0",
              "from": "shortstop-handlers@~0.1.0"
            },
            "async": {
              "version": "0.7.0",
              "from": "async@~0.7.0"
            }
          }
        },
        "body-parser": {
          "version": "1.4.3",
          "from": "body-parser@^1.0.2",
          "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.4.3.tgz",
          "dependencies": {
            "bytes": {
              "version": "1.0.0",
              "from": "bytes@1.0.0"
            },
            "depd": {
              "version": "0.3.0",
              "from": "depd@0.3.0",
              "resolved": "https://registry.npmjs.org/depd/-/depd-0.3.0.tgz"
            },
            "iconv-lite": {
              "version": "0.4.3",
              "from": "iconv-lite@0.4.3",
              "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.3.tgz"
            },
            "media-typer": {
              "version": "0.2.0",
              "from": "media-typer@0.2.0",
              "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.2.0.tgz"
            },
            "qs": {
              "version": "0.6.6",
              "from": "qs@0.6.6",
              "resolved": "https://registry.npmjs.org/qs/-/qs-0.6.6.tgz"
            },
            "raw-body": {
              "version": "1.2.2",
              "from": "raw-body@1.2.2",
              "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-1.2.2.tgz"
            },
            "type-is": {
              "version": "1.3.1",
              "from": "type-is@1.3.1",
              "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.3.1.tgz",
              "dependencies": {
                "mime-types": {
                  "version": "1.0.0",
                  "from": "mime-types@1.0.0"
                }
              }
            }
          }
        },
        "cookie-parser": {
          "version": "1.3.1",
          "from": "cookie-parser@^1.0.1",
          "dependencies": {
            "cookie": {
              "version": "0.1.2",
              "from": "cookie@0.1.2",
              "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.1.2.tgz"
            },
            "cookie-signature": {
              "version": "1.0.3",
              "from": "cookie-signature@1.0.3"
            }
          }
        },
        "static-favicon": {
          "version": "1.0.2",
          "from": "static-favicon@^1.0.2"
        },
        "serve-static": {
          "version": "1.2.3",
          "from": "serve-static@^1.0.4",
          "dependencies": {
            "escape-html": {
              "version": "1.0.1",
              "from": "escape-html@1.0.1"
            },
            "parseurl": {
              "version": "1.0.1",
              "from": "parseurl@1.0.1"
            },
            "send": {
              "version": "0.4.3",
              "from": "send@0.4.3",
              "dependencies": {
                "debug": {
                  "version": "1.0.2",
                  "from": "debug@*",
                  "resolved": "https://registry.npmjs.org/debug/-/debug-1.0.2.tgz",
                  "dependencies": {
                    "ms": {
                      "version": "0.6.2",
                      "from": "ms@0.6.2"
                    }
                  }
                },
                "finished": {
                  "version": "1.2.2",
                  "from": "finished@1.2.2",
                  "dependencies": {
                    "ee-first": {
                      "version": "1.0.3",
                      "from": "ee-first@1.0.3"
                    }
                  }
                },
                "fresh": {
                  "version": "0.2.2",
                  "from": "fresh@0.2.2"
                },
                "mime": {
                  "version": "1.2.11",
                  "from": "mime@1.2.11"
                },
                "range-parser": {
                  "version": "1.0.0",
                  "from": "range-parser@~1.0.0"
                }
              }
            }
          }
        },
        "compression": {
          "version": "1.0.8",
          "from": "compression@^1.0.1",
          "resolved": "https://registry.npmjs.org/compression/-/compression-1.0.8.tgz",
          "dependencies": {
            "accepts": {
              "version": "1.0.5",
              "from": "accepts@~1.0.5",
              "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.0.5.tgz",
              "dependencies": {
                "mime-types": {
                  "version": "1.0.0",
                  "from": "mime-types@~1.0.0"
                },
                "negotiator": {
                  "version": "0.4.6",
                  "from": "negotiator@0.4.6"
                }
              }
            },
            "bytes": {
              "version": "1.0.0",
              "from": "bytes@1.0.0"
            },
            "compressible": {
              "version": "1.1.0",
              "from": "compressible@1.1.0"
            },
            "on-headers": {
              "version": "0.0.0",
              "from": "on-headers@0.0.0"
            },
            "vary": {
              "version": "0.1.0",
              "from": "vary@0.1.0"
            }
          }
        },
        "morgan": {
          "version": "1.1.1",
          "from": "morgan@^1.0.0",
          "dependencies": {
            "bytes": {
              "version": "1.0.0",
              "from": "bytes@1.0.0"
            }
          }
        },
        "express-session": {
          "version": "1.5.1",
          "from": "express-session@^1.0.3",
          "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.5.1.tgz",
          "dependencies": {
            "buffer-crc32": {
              "version": "0.2.3",
              "from": "buffer-crc32@0.2.3",
              "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.3.tgz"
            },
            "cookie": {
              "version": "0.1.2",
              "from": "cookie@0.1.2",
              "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.1.2.tgz"
            },
            "cookie-signature": {
              "version": "1.0.3",
              "from": "cookie-signature@1.0.3"
            },
            "debug": {
              "version": "1.0.2",
              "from": "debug@*",
              "resolved": "https://registry.npmjs.org/debug/-/debug-1.0.2.tgz",
              "dependencies": {
                "ms": {
                  "version": "0.6.2",
                  "from": "ms@0.6.2"
                }
              }
            },
            "depd": {
              "version": "0.3.0",
              "from": "depd@0.3.0",
              "resolved": "https://registry.npmjs.org/depd/-/depd-0.3.0.tgz"
            },
            "on-headers": {
              "version": "0.0.0",
              "from": "on-headers@0.0.0"
            },
            "uid-safe": {
              "version": "1.0.1",
              "from": "uid-safe@1.0.1",
              "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-1.0.1.tgz",
              "dependencies": {
                "mz": {
                  "version": "1.0.0",
                  "from": "mz@1",
                  "resolved": "https://registry.npmjs.org/mz/-/mz-1.0.0.tgz"
                },
                "base64-url": {
                  "version": "1.0.0",
                  "from": "base64-url@1"
                }
              }
            },
            "utils-merge": {
              "version": "1.0.0",
              "from": "utils-merge@1.0.0"
            }
          }
        },
        "bluebird": {
          "version": "1.2.4",
          "from": "bluebird@^1.2.3"
        }
      }
    },
    "kraken-devtools": {
      "version": "1.0.0",
      "from": "kraken-devtools@^1.0.0",
      "dependencies": {
        "async": {
          "version": "0.2.10",
          "from": "async@^0.2.7"
        },
        "mkdirp": {
          "version": "0.3.5",
          "from": "mkdirp@^0.3.5"
        },
        "concat-stream": {
          "version": "1.4.6",
          "from": "concat-stream@~1.4.1",
          "dependencies": {
            "inherits": {
              "version": "2.0.1",
              "from": "inherits@~2.0.1"
            },
            "typedarray": {
              "version": "0.0.6",
              "from": "typedarray@~0.0.5"
            },
            "readable-stream": {
              "version": "1.1.13-1",
              "from": "readable-stream@~1.1.9",
              "dependencies": {
                "core-util-is": {
                  "version": "1.0.1",
                  "from": "core-util-is@~1.0.0"
                },
                "isarray": {
                  "version": "0.0.1",
                  "from": "isarray@0.0.1"
                },
                "string_decoder": {
                  "version": "0.10.25-1",
                  "from": "string_decoder@~0.10.x"
                }
              }
            }
          }
        },
        "rimraf": {
          "version": "2.2.8",
          "from": "rimraf@^2.2.6"
        },
        "minimatch": {
          "version": "0.2.14",
          "from": "minimatch@^0.2.14",
          "dependencies": {
            "lru-cache": {
              "version": "2.5.0",
              "from": "lru-cache@2"
            },
            "sigmund": {
              "version": "1.0.0",
              "from": "sigmund@~1.0.0"
            }
          }
        }
      }
    },
    "engine-munger": {
      "version": "0.2.0",
      "from": "engine-munger@^0.2.0",
      "dependencies": {
        "graceful-fs": {
          "version": "2.0.3",
          "from": "graceful-fs@~2.0.1"
        },
        "concat-stream": {
          "version": "1.4.6",
          "from": "concat-stream@~1.4.1",
          "dependencies": {
            "inherits": {
              "version": "2.0.1",
              "from": "inherits@~2.0.1"
            },
            "typedarray": {
              "version": "0.0.6",
              "from": "typedarray@~0.0.5"
            },
            "readable-stream": {
              "version": "1.1.13-1",
              "from": "readable-stream@~1.1.9",
              "dependencies": {
                "core-util-is": {
                  "version": "1.0.1",
                  "from": "core-util-is@~1.0.0"
                },
                "isarray": {
                  "version": "0.0.1",
                  "from": "isarray@0.0.1"
                },
                "string_decoder": {
                  "version": "0.10.25-1",
                  "from": "string_decoder@~0.10.x"
                }
              }
            }
          }
        },
        "karka": {
          "version": "0.0.1",
          "from": "karka@~0.0.1",
          "dependencies": {
            "shortstop": {
              "version": "0.0.1",
              "from": "shortstop@0.0.1",
              "resolved": "https://registry.npmjs.org/shortstop/-/shortstop-0.0.1.tgz"
            },
            "shortstop-handlers": {
              "version": "0.1.0",
              "from": "shortstop-handlers@~0.1.0"
            },
            "jshint": {
              "version": "2.4.4",
              "from": "jshint@~2.4.4",
              "dependencies": {
                "shelljs": {
                  "version": "0.1.4",
                  "from": "shelljs@0.1.x"
                },
                "underscore": {
                  "version": "1.4.4",
                  "from": "underscore@1.4.x"
                },
                "cli": {
                  "version": "0.4.5",
                  "from": "cli@0.4.x",
                  "dependencies": {
                    "glob": {
                      "version": "4.0.2",
                      "from": "glob@>= 3.1.4",
                      "dependencies": {
                        "inherits": {
                          "version": "2.0.1",
                          "from": "inherits@2"
                        },
                        "once": {
                          "version": "1.3.0",
                          "from": "once@^1.3.0"
                        }
                      }
                    }
                  }
                },
                "minimatch": {
                  "version": "0.3.0",
                  "from": "minimatch@0.x.x",
                  "dependencies": {
                    "lru-cache": {
                      "version": "2.5.0",
                      "from": "lru-cache@2"
                    },
                    "sigmund": {
                      "version": "1.0.0",
                      "from": "sigmund@~1.0.0"
                    }
                  }
                },
                "htmlparser2": {
                  "version": "3.3.0",
                  "from": "htmlparser2@3.3.x",
                  "dependencies": {
                    "domhandler": {
                      "version": "2.1.0",
                      "from": "domhandler@2.1"
                    },
                    "domutils": {
                      "version": "1.1.6",
                      "from": "domutils@1.1"
                    },
                    "domelementtype": {
                      "version": "1.1.1",
                      "from": "domelementtype@1"
                    },
                    "readable-stream": {
                      "version": "1.0.27-1",
                      "from": "readable-stream@1.0",
                      "dependencies": {
                        "core-util-is": {
                          "version": "1.0.1",
                          "from": "core-util-is@~1.0.0"
                        },
                        "isarray": {
                          "version": "0.0.1",
                          "from": "isarray@0.0.1"
                        },
                        "string_decoder": {
                          "version": "0.10.25-1",
                          "from": "string_decoder@~0.10.x"
                        },
                        "inherits": {
                          "version": "2.0.1",
                          "from": "inherits@~2.0.1"
                        }
                      }
                    }
                  }
                },
                "console-browserify": {
                  "version": "0.1.6",
                  "from": "console-browserify@0.1.x"
                },
                "exit": {
                  "version": "0.1.2",
                  "from": "exit@0.1.x"
                }
              }
            }
          }
        },
        "file-resolver": {
          "version": "0.0.1",
          "from": "file-resolver@~0.0.1"
        }
      }
    },
    "express": {
      "version": "4.4.4",
      "from": "express@^4.3.0",
      "resolved": "https://registry.npmjs.org/express/-/express-4.4.4.tgz",
      "dependencies": {
        "accepts": {
          "version": "1.0.5",
          "from": "accepts@~1.0.5",
          "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.0.5.tgz",
          "dependencies": {
            "mime-types": {
              "version": "1.0.0",
              "from": "mime-types@~1.0.0"
            },
            "negotiator": {
              "version": "0.4.6",
              "from": "negotiator@0.4.6"
            }
          }
        },
        "buffer-crc32": {
          "version": "0.2.3",
          "from": "buffer-crc32@0.2.3",
          "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.3.tgz"
        },
        "debug": {
          "version": "1.0.2",
          "from": "debug@*",
          "resolved": "https://registry.npmjs.org/debug/-/debug-1.0.2.tgz",
          "dependencies": {
            "ms": {
              "version": "0.6.2",
              "from": "ms@0.6.2"
            }
          }
        },
        "escape-html": {
          "version": "1.0.1",
          "from": "escape-html@1.0.1"
        },
        "methods": {
          "version": "1.0.1",
          "from": "methods@1.0.1"
        },
        "parseurl": {
          "version": "1.0.1",
          "from": "parseurl@1.0.1"
        },
        "proxy-addr": {
          "version": "1.0.1",
          "from": "proxy-addr@1.0.1",
          "dependencies": {
            "ipaddr.js": {
              "version": "0.1.2",
              "from": "ipaddr.js@0.1.2"
            }
          }
        },
        "range-parser": {
          "version": "1.0.0",
          "from": "range-parser@1.0.0"
        },
        "send": {
          "version": "0.4.3",
          "from": "send@0.4.3",
          "dependencies": {
            "finished": {
              "version": "1.2.2",
              "from": "finished@1.2.2",
              "dependencies": {
                "ee-first": {
                  "version": "1.0.3",
                  "from": "ee-first@1.0.3"
                }
              }
            },
            "mime": {
              "version": "1.2.11",
              "from": "mime@1.2.11"
            }
          }
        },
        "serve-static": {
          "version": "1.2.3",
          "from": "serve-static@^1.0.4"
        },
        "type-is": {
          "version": "1.2.1",
          "from": "type-is@1.2.1",
          "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.2.1.tgz",
          "dependencies": {
            "mime-types": {
              "version": "1.0.0",
              "from": "mime-types@~1.0.0"
            }
          }
        },
        "vary": {
          "version": "0.1.0",
          "from": "vary@0.1.0"
        },
        "cookie": {
          "version": "0.1.2",
          "from": "cookie@0.1.2",
          "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.1.2.tgz"
        },
        "fresh": {
          "version": "0.2.2",
          "from": "fresh@0.2.2"
        },
        "cookie-signature": {
          "version": "1.0.3",
          "from": "cookie-signature@1.0.3"
        },
        "merge-descriptors": {
          "version": "0.0.2",
          "from": "merge-descriptors@0.0.2"
        },
        "utils-merge": {
          "version": "1.0.0",
          "from": "utils-merge@1.0.0"
        },
        "qs": {
          "version": "0.6.6",
          "from": "qs@0.6.6",
          "resolved": "https://registry.npmjs.org/qs/-/qs-0.6.6.tgz"
        },
        "path-to-regexp": {
          "version": "0.1.2",
          "from": "path-to-regexp@0.1.2"
        }
      }
    },
    "dustjs-linkedin": {
      "version": "2.4.0",
      "from": "dustjs-linkedin@^2.0.3",
      "resolved": "https://registry.npmjs.org/dustjs-linkedin/-/dustjs-linkedin-2.4.0.tgz"
    },
    "dustjs-helpers": {
      "version": "1.2.0",
      "from": "dustjs-helpers@^1.1.1",
      "dependencies": {
        "dustjs-linkedin": {
          "version": "2.3.5",
          "from": "dustjs-linkedin@~2.3.0"
        }
      }
    },
    "adaro": {
      "version": "0.1.5",
      "from": "adaro@^0.1.5",
      "dependencies": {
        "core-util-is": {
          "version": "1.0.1",
          "from": "core-util-is@~1.0.0"
        }
      }
    },
    "localizr": {
      "version": "0.1.0",
      "from": "localizr@^0.1.0",
      "dependencies": {
        "minimist": {
          "version": "0.0.7",
          "from": "minimist@0.0.7",
          "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.7.tgz"
        },
        "findatag": {
          "version": "0.0.9",
          "from": "findatag@0.0.9",
          "dependencies": {
            "async": {
              "version": "0.2.10",
              "from": "async@0.2.x"
            },
            "readable-stream": {
              "version": "1.0.15",
              "from": "readable-stream@1.0.15"
            }
          }
        },
        "spud": {
          "version": "0.0.3",
          "from": "spud@0.0.3",
          "dependencies": {
            "string.fromcodepoint": {
              "version": "0.1.0",
              "from": "string.fromcodepoint@~0.1.0"
            }
          }
        },
        "mkdirp": {
          "version": "0.3.5",
          "from": "mkdirp@~0.3.5"
        }
      }
    },
    "less": {
      "version": "1.7.3",
      "from": "less@^1.6.1",
      "resolved": "https://registry.npmjs.org/less/-/less-1.7.3.tgz",
      "dependencies": {
        "graceful-fs": {
          "version": "2.0.3",
          "from": "graceful-fs@~2.0.3"
        },
        "mime": {
          "version": "1.2.11",
          "from": "mime@~1.2.11"
        },
        "request": {
          "version": "2.34.0",
          "from": "request@~2.34.0",
          "dependencies": {
            "qs": {
              "version": "0.6.6",
              "from": "qs@~0.6.0"
            },
            "json-stringify-safe": {
              "version": "5.0.0",
              "from": "json-stringify-safe@~5.0.0"
            },
            "forever-agent": {
              "version": "0.5.2",
              "from": "forever-agent@~0.5.0"
            },
            "node-uuid": {
              "version": "1.4.1",
              "from": "node-uuid@~1.4.0"
            },
            "tough-cookie": {
              "version": "0.12.1",
              "from": "tough-cookie@>=0.12.0",
              "dependencies": {
                "punycode": {
                  "version": "1.2.4",
                  "from": "punycode@>=0.2.0"
                }
              }
            },
            "form-data": {
              "version": "0.1.4",
              "from": "form-data@~0.1.0",
              "resolved": "https://registry.npmjs.org/form-data/-/form-data-0.1.4.tgz",
              "dependencies": {
                "combined-stream": {
                  "version": "0.0.5",
                  "from": "combined-stream@~0.0.4",
                  "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.5.tgz",
                  "dependencies": {
                    "delayed-stream": {
                      "version": "0.0.5",
                      "from": "delayed-stream@0.0.5"
                    }
                  }
                },
                "async": {
                  "version": "0.9.0",
                  "from": "async@~0.9.0"
                }
              }
            },
            "tunnel-agent": {
              "version": "0.3.0",
              "from": "tunnel-agent@~0.3.0"
            },
            "http-signature": {
              "version": "0.10.0",
              "from": "http-signature@~0.10.0",
              "dependencies": {
                "assert-plus": {
                  "version": "0.1.2",
                  "from": "assert-plus@0.1.2"
                },
                "asn1": {
                  "version": "0.1.11",
                  "from": "asn1@0.1.11"
                },
                "ctype": {
                  "version": "0.5.2",
                  "from": "ctype@0.5.2"
                }
              }
            },
            "oauth-sign": {
              "version": "0.3.0",
              "from": "oauth-sign@~0.3.0"
            },
            "hawk": {
              "version": "1.0.0",
              "from": "hawk@~1.0.0",
              "dependencies": {
                "hoek": {
                  "version": "0.9.1",
                  "from": "hoek@0.9.x"
                },
                "boom": {
                  "version": "0.4.2",
                  "from": "boom@0.4.x"
                },
                "cryptiles": {
                  "version": "0.2.2",
                  "from": "cryptiles@0.2.x"
                },
                "sntp": {
                  "version": "0.2.4",
                  "from": "sntp@0.2.x"
                }
              }
            },
            "aws-sign2": {
              "version": "0.5.0",
              "from": "aws-sign2@~0.5.0"
            }
          }
        },
        "mkdirp": {
          "version": "0.3.5",
          "from": "mkdirp@~0.3.5"
        },
        "clean-css": {
          "version": "2.1.8",
          "from": "clean-css@2.1.x",
          "dependencies": {
            "commander": {
              "version": "2.1.0",
              "from": "commander@2.1.x"
            }
          }
        },
        "source-map": {
          "version": "0.1.34",
          "from": "source-map@0.1.x",
          "dependencies": {
            "amdefine": {
              "version": "0.1.0",
              "from": "amdefine@>=0.0.4"
            }
          }
        }
      }
    },
    "newrelic": {
      "version": "1.7.3",
      "from": "newrelic@",
      "dependencies": {
        "bunyan": {
          "version": "0.14.6",
          "from": "bunyan@0.14.6",
          "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-0.14.6.tgz"
        },
        "continuation-local-storage": {
          "version": "3.0.0",
          "from": "continuation-local-storage@^3.0.0",
          "resolved": "https://registry.npmjs.org/continuation-local-storage/-/continuation-local-storage-3.0.0.tgz",
          "dependencies": {
            "emitter-listener": {
              "version": "1.0.1",
              "from": "emitter-listener@1.0.1",
              "resolved": "https://registry.npmjs.org/emitter-listener/-/emitter-listener-1.0.1.tgz",
              "dependencies": {
                "shimmer": {
                  "version": "1.0.0",
                  "from": "shimmer@1.0.0",
                  "resolved": "https://registry.npmjs.org/shimmer/-/shimmer-1.0.0.tgz"
                }
              }
            },
            "async-listener": {
              "version": "0.4.5",
              "from": "async-listener@0.4.5",
              "resolved": "https://registry.npmjs.org/async-listener/-/async-listener-0.4.5.tgz",
              "dependencies": {
                "shimmer": {
                  "version": "1.0.0",
                  "from": "shimmer@1.0.0",
                  "resolved": "https://registry.npmjs.org/shimmer/-/shimmer-1.0.0.tgz"
                }
              }
            }
          }
        },
        "yakaa": {
          "version": "1.0.0",
          "from": "yakaa@^1.0.0",
          "resolved": "https://registry.npmjs.org/yakaa/-/yakaa-1.0.0.tgz"
        }
      }
    }
  }
}
groundwater commented 10 years ago

This is great, I'm going to try to reproduce the issue locally.

groundwater commented 10 years ago

This is definitely a bug. I've reproduced your error. It looks like there is an extra call to app.handle and _router isn't set on the second pass. I have a feeling the error is related to the additional call, and not the lack of the _router property.

Here is the stack trace on the legit call to _router.handle

    at Function.app.handle (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/application.js:125:15)
    at Server.app (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/express.js:28:9)
    at Server.wrappedHandler (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/lib/instrumentation/core/http.js:72:21)
    at Server.<anonymous> (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/node_modules/continuation-local-storage/context.js:76:17)
    at cb_bind (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/lib/transaction/tracer.js:150:42)
    at /Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/node_modules/continuation-local-storage/context.js:76:17
    at Server.wrapTransactionInvocation (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/lib/transaction/tracer.js:151:28)
    at Server.EventEmitter.emit (events.js:98:17)
    at HTTPParser.parser.onIncoming (http.js:2108:12)
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23)
    at Socket.socket.ondata (http.js:1966:22)
    at TCP.onread (net.js:527:27)
    at TCP.onread (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31)

Here is the stack trace of the second pass, where this._router is undefined:

    at Function.app.handle (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/application.js:125:15)
    at Layer.fn (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/application.js:193:17)
    at Layer.eval [as handle] (eval at wrapHandle (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/lib/instrumentation/express.js:246:41), <anonymous>:10:14)
    at trim_prefix (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/router/index.js:254:17)
    at /Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/router/index.js:216:9
    at Function.proto.process_params (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/router/index.js:286:12)
    at Function.cls_wrapProcessParams [as process_params] (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/lib/instrumentation/express.js:185:29)
    at next (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/router/index.js:207:19)
    at /Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/node_modules/continuation-local-storage/context.js:76:17
    at Layer.expressInit (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/middleware/init.js:23:5)
    at Layer.expressInit [as handle] (eval at wrapHandle (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/lib/instrumentation/express.js:246:41), <anonymous>:10:14)
    at trim_prefix (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/router/index.js:254:17)
    at /Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/router/index.js:216:9
    at Function.proto.process_params (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/router/index.js:286:12)
    at Function.cls_wrapProcessParams [as process_params] (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/lib/instrumentation/express.js:185:29)
    at next (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/router/index.js:207:19)
    at /Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/node_modules/continuation-local-storage/context.js:76:17
    at Layer.query (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/middleware/query.js:37:5)
    at Layer.query [as handle] (eval at wrapHandle (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/lib/instrumentation/express.js:246:41), <anonymous>:10:14)
    at trim_prefix (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/router/index.js:254:17)
    at /Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/router/index.js:216:9
    at Function.proto.process_params (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/router/index.js:286:12)
    at Function.cls_wrapProcessParams [as process_params] (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/lib/instrumentation/express.js:185:29)
    at next (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/router/index.js:207:19)
    at Function.proto.handle (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/router/index.js:154:3)
    at Function.app.handle (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/application.js:129:16)
    at Server.app (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/express/lib/express.js:28:9)
    at Server.wrappedHandler (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/lib/instrumentation/core/http.js:72:21)
    at Server.<anonymous> (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/node_modules/continuation-local-storage/context.js:76:17)
    at cb_bind (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/lib/transaction/tracer.js:150:42)
    at /Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/node_modules/continuation-local-storage/context.js:76:17
    at Server.wrapTransactionInvocation (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/lib/transaction/tracer.js:151:28)
    at Server.EventEmitter.emit (events.js:98:17)
    at HTTPParser.parser.onIncoming (http.js:2108:12)
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23)
    at Socket.socket.ondata (http.js:1966:22)
    at TCP.onread (net.js:527:27)
    at TCP.onread (/Users/jacob/Projects/BUGFIX/issue-160/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31)

Something is definitely funky.

oblador commented 10 years ago

Any progress?

oblador commented 10 years ago

In 1.7.5 this crash doesn't occur any more, but instead all requests end in 404s.

txase commented 10 years ago

Hi oblador,

We're still working on this issue. It's a tricky one. Please bear with us.

tponte commented 10 years ago

Hi there. I tried using kraken with newrelic 1.8.1 and express 4.6.1 and the error now is that my routes cannot be resolved. Using express 4.4.1 the error was the same as first reported by oblador.

ghost commented 10 years ago

Saw the same issue (routes not resolving) with newrelic / krakenjs combo.

txase commented 10 years ago

Hi folks,

We have made a few attempts to fix this issue, but it's a stubborn one... At the same time, we are working on closing this public GitHub issues tracker and funneling customers through http://support.newrelic.com. We can provide better support through our dedicated portal than we have been able to provide here.

I'm going to close this issue out, even though we have duplicated it as a known defect internally. If you are still seeing this issue and want to follow up with us about it, please do so at http://support.newrelic.com.

Thanks!