thingdom / node-neo4j

[RETIRED] Neo4j graph database driver (REST API client) for Node.js
Apache License 2.0
926 stars 136 forks source link

TypeError: Error.captureStackTrace is not a function #211

Open kderbalah opened 7 years ago

kderbalah commented 7 years ago

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);

TimothyMischief commented 7 years ago

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.

pito-svk commented 7 years ago

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 7 years ago

I figured out a fix. see my post

pito-svk commented 7 years ago

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 7 years ago

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

cagataycali commented 7 years ago

Is there a any news?

noeljackson commented 7 years ago

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

ekkis commented 7 years ago

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

DiegoGallegos4 commented 7 years ago

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

willynilly commented 7 years ago

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

pito-svk commented 7 years ago

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