node.js connect-redis redis.get(key,callback) return null

in connect-redis to return session value use .get(sid, callback) but it always return null so I think its not save in redis but I check it session save in redis correctly after investigation find problem is with Sid see /connect-redis/lib/connect-redis.js

  RedisStore.prototype.get = function(sid, fn){
   sid =this.prefix + sid;
    debug('GET "%s"', sid);

    console.log('lib');
    console.log(sid);

    this.client.get( sid , function(err, data){

      if (err) return fn(err);
      if (!data) return fn(null,'');
      var result;
      data = data.toString();
      debug('GOT %s', data);
      try {
        result = JSON.parse(data); 
      } catch (err) {
        return fn(err);
      }

      return fn(null, result);
    });
  };

if I but sessionID as string it will return session

  RedisStore.prototype.get = function(sid, fn){

  //  sid =this.prefix + sid;
    debug('GET "%s"', sid);

    console.log('lib');
    console.log(sid);

    this.client.get( 'lweUw//EdbygbGr/2gAZt0kb' , function(err, data){

      if (err) return fn(err);
      if (!data) return fn(null,'');
      var result;
      data = data.toString();
      debug('GOT %s', data);
      try {
        result = JSON.parse(data); 
      } catch (err) {
        return fn(err);
      }

      return fn(null, result);
    });
  };

Note:

typeof(sid) is string even if add qoute to sid like this "\'sid\'" it will return null

The callback takes the form callback(err, data). If there is no error, the first parameter will always be null. The real response is in the second parameter.

See: return fn(null, result); in .get().