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

Unknown ReqlRuntimeError. #340

Closed kyranet closed 7 years ago

kyranet commented 7 years ago

I have an application successfully working for months, and I used to test the functions with this package locally before pushing to my host. Despite of having http://localhost:8080/#tables running as intended, it refuses to work.

Code:

const r = require('rethinkdbdash')();
r.table('guilds').run();

The eval returns:

Promise {
  _bitField: 0,
  _fulfillmentHandler0: undefined,
  _rejectionHandler0: undefined,
  _promise0: undefined,
  _receiver0: undefined }

And in the console:

Uncaught Promise Error:
ReqlRuntimeError
    at Connection._processResponse (C:\Users\Skyra\node_modules\rethinkdbdash\lib\connection.js:395:15)
    at Socket.<anonymous> (C:\Users\Skyra\node_modules\rethinkdbdash\lib\connection.js:201:14)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at addChunk (_stream_readable.js:250:12)
    at readableAddChunk (_stream_readable.js:237:11)
    at Socket.Readable.push (_stream_readable.js:195:10)
    at TCP.onread (net.js:586:20)

So, I wondered if my Rethinkdb.exe (Windows) were corrupt or something, but the package rethinkdb worked fine. Using the script from https://www.rethinkdb.com/docs/install-drivers/javascript/

r = require('rethinkdb')
r.connect({ host: 'localhost', port: 28015 }, function(err, conn) {
  if(err) throw err;
  r.db('test').tableCreate('tv_shows').run(conn, function(err, res) {
    if(err) throw err;
    console.log(res);
    r.table('tv_shows').insert({ name: 'Star Trek TNG' }).run(conn, function(err, res)
    {
      if(err) throw err;
      console.log(res);
    });
  });
});

Additionally:

OzySky commented 7 years ago

You have to connect to the db first. As in r.db('war').table('guilds') for example

OzySky commented 7 years ago

unless your tables are in the test (default) database

neumino commented 7 years ago

@kyranet feel free to reopen if you still have an issue.

But the driver receive an error from the server, likely because you are reaching the wrong table or are doing an invalid query. Catch the error and print it if you need more help.