neumino / rethinkdbdash

An advanced Node.js driver for RethinkDB with a connection pool, support for streams etc.
MIT License
848 stars 108 forks source link

Got a very strange error with latest rethinkdbdash and Node 5.5 #305

Closed thelinuxlich closed 8 years ago

thelinuxlich commented 8 years ago
/app/releases/20161013155215/node_modules/rethinkdbdash/lib/term.js:3016
 throw new Error.ReqlDriverError('`'+method+'` takes '+num+' argument'+((num>1)?'s':'')+', '+args.length+' provided', term._query);
 ^
ReqlDriverError: `toJSON` takes 0 argument, 1 provided after:
 r.ISO8601("2016-10-13T17:17:59-03:00")
 at Term._arity (/app/releases/20161013155215/node_modules/rethinkdbdash/lib/term.js:3016:11)
at Term.toJsonString (/app/releases/20161013155215/node_modules/rethinkdbdash/lib/term.js:2767:10)
at Object.stringify (native)
at Object.stringify (/app/releases/20161013155215/node_modules/core-js/modules/es6.symbol.js:128:21)
 at stringify (/app/releases/20161013155215/node_modules/json-stringify-safe/stringify.js:5:15)
at Client.send (/app/releases/20161013155215/node_modules/raven/lib/client.js:122:17)
 at Client.process (/app/releases/20161013155215/node_modules/raven/lib/client.js:114:25)
at /app/releases/20161013155215/node_modules/raven/lib/client.js:165:23
 at /app/releases/20161013155215/node_modules/raven/lib/parsers.js:52:5
 at /app/releases/20161013155215/node_modules/raven/lib/utils.js:169:30
 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:404:3)
marshall007 commented 8 years ago

@thelinuxlich I've seen this error before when accidentally attempting to serialize a ReQL query to JSON. Certain implementations call the toJSON method when it is defined as a way to override default serialization.

See the MDN docs on this.

thelinuxlich commented 8 years ago

But then it wouldn't be a rethinkdbdash error, right?

neumino commented 8 years ago

It would be because you cannot serialize a ReQL term in JSON.

jaladankisuresh commented 8 years ago

@neumino I seem to be running into similar issue as @thelinuxlich

This is what i had been trying to achieve. And, I am using thinky.r for this. I am trying to generate change feed for new documents in the Table, and end up with the same ReqlDriverError error. I did try with both run() and execute(). r.table('table').changes({includeTypes: true}) .filter(r.row('type').eq('add'))('new_val').execute() .then(function(feed) { feed.each(function(err, change) { if (err) { console.log(err.toString()); console.log(err.stack); } else { console.log(change); } });

I did manage to get what i am after with the rethinkdb javascript driver using the code below. Yeah, without this error r.table('table').changes({includeTypes: true}) .filter(r.row('type').eq('add'))('new_val').execute() .then(function(feed) { feed.each(function(err, change) { if (err) { console.log(err.toString()); console.log(err.stack); } else { console.log(change); } }); })

Do you think, this could be some issue with rethinkdbdash?