nconf-redis icon indicating copy to clipboard operation
nconf-redis copied to clipboard

null value throws TypeError

Open itayw opened this issue 11 years ago • 1 comments

If you have an JSON key that contains some null values it will throw an exception when you try to save the key.

TL;DR demo of the issue: https://gist.github.com/itayw/7566317

JSON example:

var badJSON = {
  port: 40008,
  securePort: null
}

Fails on:

-->nconf.set('badJSON', badJSON, function(err) {
  if (err)
    throw err;
  nconf.get('badJSON', function(err, value) { 
    if (err)
      throw err;

    if (value)
      console.log('bad JSON value set and get fine.');
    else
      console.log('Failed to set and get bad JSON value')
  });
});

Exception and stack:

TypeError: Object.keys called on non-object
    at Function.keys (native)
    at Redis._setObject (/.../dev/joola.io.manage/node_modules/nconf-redis/lib/nconf-redis.js:425:23)
...

itayw avatar Nov 20 '13 16:11 itayw

I'm getting this issue as well :|

cyrusdavid avatar Mar 27 '14 12:03 cyrusdavid