ERR syntax error caused by invalid arguments when ttl is enabled in connect-redis
### ERR syntax error caused by invalid arguments when ttl is enabled in connect-redis
Summary:
When using connect-redis with TTL enabled (default behavior), the library sometimes sends invalid arguments to Redis commands such as SET. This leads to Redis ERR syntax error failures.
Details:
The Redis command SET expects arguments like SET key value EX seconds (to set expiry in seconds).
Internally, connect-redis attempts to set the TTL by adding expiry options (EX, PX) based on the ttl or session cookie maxAge.
However, due to a bug or mismatch in how arguments are constructed or passed, the Redis client receives an [object Object] or malformed parameter instead of a valid TTL number.
This results in errors similar to:
```
ReplyError: ERR syntax error
at parseError (...redis-parser...)
command: {
name: 'set',
args: [
'session:key',
'{"cookie":{...},"data":...}',
'[object Object]'
]
}
```


3 条评论