Monday 8 May 2017

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

I'm using the connect-redis-crypto module (https://github.com/jas-/connect-redis-crypto ) which is built for encrypting redis session data on top of connect-redis(https://github.com/tj/connect-redis). My redis version is 3.2.8.

I am running into error node-redis: Deprecated: The SET command contains a argument of type Object. Based on the larger error message, it seems to come from trying to parse the string [object Object] when it is not a JSON string. I put nested objects that hold user information on req.session which directly gets stored (and ideally encrypted) in redis.

From some sources I learned nested objects in Redis are not allowed which might cause this error, but I believe this library stores data as JSON to allow for nested objects. connect-redis works fine for me, but when this connect-redis-crypto library tries to JSON parse encrypted data it throws me this particular error.

Would really appreciate 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)


via Cookies

No comments:

Post a Comment