Node-redis: error:ERR value is not an integer or out of range code:

Created on 22 Feb 2019  路  2Comments  路  Source: NodeRedis/node-redis

I get the error error:ERR value is not an integer or out of range code: when doing client.set.
The error returned contains

{
  "command": "SET",
  "args": [
    "1fd24e820c01a0695048558632dfb832", "VERY_LONG_TEXT",
    "EX",
    null
  ],
  "code": "ERR"
}

where VERY_LONG_TEXT is a string of ~80KB characters

question

Most helpful comment

@loretoparisi the problem is the third argument as it's set to null.

All 2 comments

@loretoparisi the problem is the third argument as it's set to null.

@BridgeAR thank you! So it seems it was the cache expire in my api wrapper, just added this simple check

function isInt(value) {
            return !isNaN(value) && (function (x) { return (x | 0) === x; })(parseFloat(value))
        }
var expire = isInt(expireValue)?expireValue:defaultValue
self.client.set(key, value, 'EX', expire, function (err, res) {
                // res is null when the key is missing
                if (err) self.logger.error("RedisStore.set err %@", err);
                else self.logger.debug("RedisStore.set %@", key);
                return callback(err, res);
            });
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

id0Sch picture id0Sch  路  4Comments

aletorrado picture aletorrado  路  6Comments

michaelwittig picture michaelwittig  路  3Comments

strumwolf picture strumwolf  路  4Comments