LiveQueryServer crash when configured to use RedisCacheAdapter

I’m running into an issue trying to get redis (via bitnami chart) working with livequery on parse-server 7.2.0. I’ve tried a few different versions of the chart, 12.8.3, 20.2.2 and I’m still hitting an issue where the RedisCacheAdapter throws an exception when it tries to clear() (triggered when object that the client subscribes to gets updated).

I’m guessing it may be related to the particular redis I’m running - some config option. I’ve already figured out that by default bitnami charts disable commands FLUSHDB and FLUSHALL and I have overridden these options.

Any ideas on any other options/configuration to check?

Here’s the exception I get:

error: RedisCacheAdapter error on get {"error":{}}
error: RedisCacheAdapter error on get {"error":{}}
An uncaught exception occurred: The client is closedStack Trace:
Error: The client is closed
at Commander._RedisClient_sendCommand (/parse-server/node_modules/@redis/client/dist/lib/client/index.js:510:31)
at Commander.commandsExecutor (/parse-server/node_modules/@redis/client/dist/lib/client/index.js:190:154)
at BaseClass.<computed> [as set] (/parse-server/node_modules/@redis/client/dist/lib/commander.js:8:29)
at RedisCacheAdapter.put (/parse-server/lib/Adapters/Cache/RedisCacheAdapter.js:85:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

I’m using the stock parse-server docker image. Here’s the configuration log on server startup:

liveQuery: {"classNames":["xxxxx"],"redisURL":"redis://dev-redis-cache-livequery-server-master:6379","redisOptions":{"password":"xxxxxxxxxxxxx","socket":{"keepAlive":true,"reconnectStrategy":"exponential","connectTimeout":10000,"host":"dev-redis-cache-livequery-server-master","port":6379,"noDelay":true},"no_ready_check":true}}
liveQueryServerOptions: {"logLevel":"verbose","redisURL":"redis://dev-redis-cache-livequery-server-master:6379","redisOptions":{"password":"xxxxxxxxxxxxx","socket":{"keepAlive":true,"reconnectStrategy":"exponential","connectTimeout":10000,"host":"dev-redis-cache-livequery-server-master","port":6379,"noDelay":true},"no_ready_check":true},"appId":"xxxxxxx","masterKey":"xxxxxxxxxx","cacheTimeout":5000,"server":{"requestTimeout":300000,"headersTimeout":60000,"keepAliveTimeout":5000,"connectionsCheckingInterval":30000,"requireHostHeader":true,"rejectNonStandardBodyWrites":false,"_events":{"connection":[null,null],"listening":[null,null]},"_eventsCount":5,"_connections":0,"_handle":{"reading":false},"_usingWorkers":false,"_workers":[],"_unref":false,"_listeningId":2,"allowHalfOpen":true,"pauseOnConnect":false,"noDelay":true,"keepAlive":false,"keepAliveInitialDelay":0,"highWaterMark":16384,"httpAllowHalfOpen":false,"timeout":0,"maxHeadersCount":null,"maxRequestsPerSocket":0,"_connectionKey":"4:0.0.0.0:1337"}}

Renamed the title of the thread.

After debugging I see that this is a bug that is exposed when we upgraded the from redis 3 to redis 4 node client (redis 4 requires explicit calling of connect()).

I logged this as an issue here LiveQueryServer crashes when configured to run with Redis cacheAdapter · Issue #9432 · parse-community/parse-server · GitHub

the work-around is to disable the redis cache specifically for the Live Query server.