Open bkolobara opened 9 years ago
Looks like the ReQL driver cannot connect to the server. Check to make sure you have access to the server with the appropriate port configuration.
The whole setup is really simple. I run the server locally. Because of this I'm not sure what could be failing. This is the config:
var express = require('express');
var session = require('express-session');
var RDBStore = require('express-session-rethinkdb')(session);
var rDBStore = new RDBStore({
connectOptions: {
servers: [
{ host: '127.0.0.1', port: 28015 }
],
db: 'sc',
discovery: false,
pool: false,
buffer: 50,
max: 1000,
timeout: 20,
timeoutError: 1000
},
table: 'sessions',
sessionTimeout: 1296000000,
flushInterval: 3600000
});
var app = express();
app.use( require('cookie-parser')() );
app.use( session({
key: "sid",
secret: "xxxxxxxxxxxxxxxxx",
cookie: { maxAge: 860000 },
store: rDBStore,
resave: false,
saveUninitialized: true
})
);
Looks right. But this issue is a ReQL driver issue, not really a express-session-rethinkdb specific issue as it has to deal with the connection itself. Is there an authKey set on the database?
No authKey. Something like:
r = require('rethinkdb');
r.connect({ host: '127.0.0.1', port: 28015 }, function(err, conn) { ... });
works fine. That's why I was assuming it's an express-session-rethinkd issue.
I'm not sure how I would increase the verbosity to see what is actually failing. I switched to https://github.com/llambda/session-rethinkdb and it is working fine. So I guess it's something express-session-rethinkdb specific.
The code to establish a connection itself is pretty simple:
var rethinkdb = require('rethinkdbdash');
r = new rethinkdb(options.connectOptions);
Version 0.2.0 of express-session-rethinkdb should point to the latest version of rethinkdbdash ( 2.1.6 - atm ). Please double check the version of rethinkdbdash in the express-session-rethinkdb dependency tree. Also put some console.log calls after the connection to give it some verbosity.
It looks like this code is never called. If I try it manually without rethinkdb running it throws an exception (not able to connect), but if I try to run express-session-rethinkdb it doesn't throw anything.
express-session-rethinkdb@0.2.0 rethinkdbdash@2.1.8 node.js@4.0.0
I had this same issue. Had to create the session table and turn 'pool' to true.
r.db('databaseName').tableCreate('session');
I had the same problem. I had to set 'pool' option to true and now it works.
It didn't work for me. I suggest allowing your own rdb driver and/or connection object. Currently this module is very brittle because it uses all *
dependencies..
If anyone is interested I rewrote it to take a connection object with the official driver https://github.com/armenfilipetyan/express-session-rethinkdb/pull/7 If there is interest I can publish to npm.
I'm getting this error on each request and can't figure out what is breaking. I double checked the database configuration and everything looks right.
Here is the full stack trace: