thingdom/node-neo4j

TypeError: Error.captureStackTrace is not a function

kderbalah opened this issue · 11 comments

I get this error after upgrading the Nodejs version from v6.9.2 to v7.0.1

TypeError: Error.captureStackTrace is not a function
    at ClientError.Error [as constructor] (/Users/kde/Workspace/icservice/node_modules/neo4j/lib-new/errors.coffee:9:15)
    at new ClientError (/Users/kde/Workspace/icservice/node_modules/neo4j/lib-new/errors.js:81:48)
    at Function.__dirname.Error.Error._fromObject (/Users/kde/Workspace/icservice/node_modules/neo4j/lib-new/errors.coffee:95:13)
    at /Users/kde/Workspace/icservice/node_modules/neo4j/lib-new/GraphDatabase.coffee:332:29
    at Request._callback (/Users/kde/Workspace/icservice/node_modules/neo4j/lib-new/GraphDatabase.coffee:100:24)
    at Request.self.callback (/Users/kde/Workspace/icservice/node_modules/request/request.js:186:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/Users/kde/Workspace/icservice/node_modules/request/request.js:1081:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (/Users/kde/Workspace/icservice/node_modules/request/request.js:1001:12)
    at IncomingMessage.g (events.js:292:16)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)

It might be the V8 issue (bumped up version in Nodejs 7 to v8 5.4)

this.Error = (function(_super) {
    __extends(Error, _super);

    function Error(message, neo4j) {
      this.message = message != null ? message : 'Unknown error';
      this.neo4j = neo4j != null ? neo4j : {};
      this.name = 'neo4j.' + this.constructor.name;
      Error.captureStackTrace(this, this.constructor);
    }
...

I guess we should call the global one global.Error.captureStackTrace(this, this.constructor);

Same is still true for all versions of node above v7.0.1. I've tested on 7.3.1 and 8.0.0 nightlies and getting the same results. If it is a node issue it doesn't seem to have been addressed yet.

I was going to look at a PR but I don't know coffee well enough and solves to similar problems in other packages seem quite involved.

any ideas about how to fix it? I would like to use nodejs version 7.4.0 for async await functionality with harmony. Thanks.

ekkis commented

I figured out a fix. see my post

This is not a fix, but rather hack. I found that this repo isn't very maintained. Switched to officially supported https://github.com/neo4j/neo4j-javascript-driver

ekkis commented

it's on my TODO list, to upgrade to the new drivers. was your upgrade painful? I've been putting it off because everything's a rabbit hole

Is there a any news?

I resorted to using https://github.com/neo4j/neo4j-javascript-driver for many reasons and it is working well.

ekkis commented

yeah. I did the upgrade as well. it was painful as expected but definitely worth the effort

Upgrading to supported driver is the solution, move away from this repo in the meanwhile.

Yeah, I'm getting this error as well. Anyone know when it will be fixed?

@willynilly never I think :) just use official repo - https://github.com/neo4j/neo4j-javascript-driver