node-neo4j icon indicating copy to clipboard operation
node-neo4j copied to clipboard

TypeError: Error.captureStackTrace is not a function

Open kderbalah opened this issue 8 years ago • 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);

kderbalah avatar Dec 21 '16 23:12 kderbalah

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.

TimothyMischief avatar Dec 26 '16 06:12 TimothyMischief

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

pito-svk avatar Jan 23 '17 21:01 pito-svk

I figured out a fix. see my post

ekkis avatar Feb 19 '17 22:02 ekkis

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

pito-svk avatar Feb 19 '17 23:02 pito-svk

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

ekkis avatar Feb 20 '17 17:02 ekkis

Is there a any news?

cagataycali avatar Mar 17 '17 08:03 cagataycali

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

noeljackson avatar May 03 '17 12:05 noeljackson

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

ekkis avatar May 03 '17 21:05 ekkis

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

DiegoGallegos4 avatar May 09 '17 01:05 DiegoGallegos4

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

willynilly avatar May 24 '17 19:05 willynilly

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

pito-svk avatar May 24 '17 21:05 pito-svk