title: Error in NodeJS when using express session with Redis
body: <p>I have a project in Node.js where I used MemoryStore from express-session, but when I changed to use the session with redis (connect-redis) I receive the error <strong>ERR wrong number of arguments for 'set' command</strong> when accessing any page and cannot log in (because the session is not created, or is created incorrectly).</p>
  
  <p>Trying to find why this is happening I created a simple project to see what is causing the error, but even after a lot of search I could not find the reason. I followed the instructions in <a href="https://github.com/tj/connect-redis" rel="nofollow noreferrer">https://github.com/tj/connect-redis</a> and saw a lot of examples here in <a href="https://stackoverflow.com/">https://stackoverflow.com/</a> but the error is still happening. I tested in more ways (commented lines and others), but it's still happening. It only occurs when acessing a page (<code>localhost:3000</code>, there's only this page in this test), not on the server start.</p>
  
  <hr>
  
  <p>The <code>package.json</code> file:</p>
  
  <pre class="lang-json prettyprint-override"><code>{
    "name": "test",
    "description": "Test",
    "version": "0.0.1",
    "private": false,
    "scripts": {
      "start": "node app.js"
    },
    "dependencies": {
      "express": "^4.13.1",
      "express-load": "^1.1.15",
      "express-session": "^1.13.0",
      "cookie-parser": "^1.4.1",
      "redis": "^2.4.2",
      "connect-redis": "^3.0.2",
      "ejs": "^2.4.1"
    }
  }
  </code></pre>
  
  <p>The <code>app.js</code> file:</p>
  
  <pre class="lang-js prettyprint-override"><code>const SECRET = 'test';
  
  var express = require('express')
    , load = require('express-load')
    , expressSession = require('express-session')
    , cookieParser = require('cookie-parser')
    , cookie = cookieParser(SECRET)
    //, cookie = cookieParser()
    , redis = require('redis')
    , RedisStore = require('connect-redis')(expressSession)
    //, redisClient = redis.createClient()
    , redisClient = redis.createClient({host: '127.0.0.1', port: '6379'})
    , store = new RedisStore({client: redisClient})
    //, store = new RedisStore({host: '127.0.0.1', port: '6379'})
    //, store = new expressSession.MemoryStore()
    , session = expressSession({
        store: store,
        secret: SECRET, 
        resave: true, 
        saveUninitialized: true
      })
    , app = express()
    , server = require('http').Server(app)
  ;
  
  app.set('views', __dirname + '/views');
  app.set('view engine', 'ejs');
  app.use(cookie);
  app.use(session);
  
  load('controllers')
    .then('routes')
    .into(app)
  ;
  
  server.listen(3000, function() {
    console.log('Testing...');
  });
  </code></pre>
  
  <p>If I comment <code>, store = new RedisStore({client: redisClient})</code> and uncomment <code>, store = new expressSession.MemoryStore()</code>, I don't receive the error and it works fine with sessions. This test project is very simple and I find it weird that the error still happens, when I do the same thing like many other examples that I saw.</p>
  
  <p>This test project - aside from the node_modules - only has 1 page <code>/views/home/index.ejs</code>, 1 controller <code>/controllers/home.js</code> and 1 route <code>/routes/home.js</code>, but they are very simple and the only thing they do is lead the user to the simple page <code>/views/home/index.ejs</code>, so the error must not be in one of those.</p>
  
  <hr>
  
  <p><strong>Edit</strong></p>
  
  <p>The error stack trace:</p>
  
  <pre><code>[path]\test&gt;npm start
  
  &gt; test@0.0.1 start [path]\test
  &gt; node app.js
  
  Testing...
  Error: ERR wrong number of arguments for 'set' command
      at JavascriptReplyParser._parseResult ([path]\test\node_modules\redis\lib\parsers\javascript.js:43:16)
      at JavascriptReplyParser.try_parsing ([path]\test\node_modules\redis\lib\parsers\javascript.js:114:21)
      at JavascriptReplyParser.run ([path]\test\node_modules\redis\lib\parsers\javascript.js:126:22)
      at JavascriptReplyParser.execute ([path]\test\node_modules\redis\lib\parsers\javascript.js:107:10)
      at Socket.&lt;anonymous&gt; ([path]\test\node_modules\redis\index.js:131:27)
      at emitOne (events.js:77:13)
      at Socket.emit (events.js:169:7)
      at readableAddChunk (_stream_readable.js:146:16)
      at Socket.Readable.push (_stream_readable.js:110:10)
      at TCP.onread (net.js:523:20)
  </code></pre>