Error with node-redis: Deprecated: SET command contains an argument of type Object

I am using a module connect-redis-crypto

( https://github.com/jas-/connect-redis-crypto ) which is built to encrypt redis session data on top of connect-redis

( https://github.com/tj/connect-redis ). My version of redis 3.2.8

.

I ran into an error node-redis: Deprecated: The SET command contains a argument of type Object

. Based on the larger error message, it looks like it is trying to [object Object]

parse the string when it is not a JSON string. I put nested objects that store user information on req.session

, which is directly stored (and ideally encrypted) in redis.

I learned from some sources that nested objects are not allowed in Redis, which can cause this error, but I believe this library stores data as JSON to allow nested objects. connect-redis

works great for me, but when this library connect-redis-crypto

tries to JSON parse encrypted data, it throws me this particular error.

Would be grateful for your help!

node_redis: Deprecated: The SET command contains a argument of type Object.
This is converted to "[object Object]" by using .toString() now and will return an error from v.3.0 on.
Please handle this in your code to make sure everything works as you intended it to.
8 May 18:24:48 - ---NEW REQUEST---
REQUEST : GET /api/somePath/client
QUERY   : {}
BODY    : {}
data [object Object]
err SyntaxError: Unexpected token o in JSON at position 1
    at JSON.parse (<anonymous>)
    at Command.callback (/Users/Documents/web-AOT/server/node_modules/connect-redis-crypto/lib/connect-redis.js:262:35)
    at normal_reply (/Users/Documents/web-AOT/server/node_modules/redis/index.js:721:21)
    at RedisClient.return_reply (/Users/Documents/web-AOT/server/node_modules/redis/index.js:819:9)
    at JavascriptRedisParser.returnReply (/Users/Documents/web-AOT/server/node_modules/redis/index.js:192:18)
    at JavascriptRedisParser.execute (/Users/Documents/web-AOT/server/node_modules/redis-parser/lib/parser.js:560:12)
    at Socket.<anonymous> (/Users/Documents/web-AOT/server/node_modules/redis/index.js:274:27)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:189:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:551:20)
      

Run codeHide result


+3


source to share


1 answer


Actually I was able to fix the error by doing tricks through the forked library. :)

If anyone comes across this error ...



https://github.com/rjlee7/connect-redis-crypto

0


source







All Articles