I’ve updated all my npm packages, including redis (3.1.2 → 4.3.1 ) and redis connect(6.0.0 → 6.1.3).
I’m getting the following error:
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: The client is closed
at Commander._RedisClient_sendCommand (/opt/node_app/node_modules/@redis/client/dist/lib/client/index.js:415:31)
at Commander.commandsExecutor (/opt/node_app/node_modules/@redis/client/dist/lib/client/index.js:170:154)
at Commander.BaseClass.<computed> [as get] (/opt/node_app/node_modules/@redis/client/dist/lib/commander.js:8:29)
at RedisStore.get (/opt/node_app/node_modules/connect-redis/lib/connect-redis.js:33:19)
at session (/opt/node_app/node_modules/express-session/index.js:485:11)
at Layer.handle [as handle_request] (/opt/node_app/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/opt/node_app/node_modules/express/lib/router/index.js:328:13)
at /opt/node_app/node_modules/express/lib/router/index.js:286:9
at Function.process_params (/opt/node_app/node_modules/express/lib/router/index.js:346:12)
at Function.process_params (/opt/node_app/node_modules/@sentry/tracing/cjs/integrations/node/express.js:266:34)
This seems to be caused completely by updating redis. There’s something in the code that isn’t ready for the updated version?
I’ve tried downgrading the connect-redis again, that didn’t work. Same error.
Then I downgraded redis as well, back to 3.1.2 and that got rid of the error.
{"status":"500","message":"The client is closed","stack":"Error: The client is closed\n at Commander._RedisClient_sendCommand (/opt/node_app/node_modules/@redis/client/dist/lib/client/index.js:482:31)\n at Commander._RedisClient_legacySendCommand (/opt/node_app/node_modules/@redis/client/dist/lib/client/index.js:448:105)\n at Commander.sendCommand (/opt/node_app/node_modules/@redis/client/dist/lib/client/index.js:420:114)\n at <computed> [as get] (/opt/node_app/node_modules/@redis/client/dist/lib/client/index.js:466:27)\n at RedisStore.get (/opt/node_app/node_modules/connect-redis/lib/connect-redis.js:33:19)\n at session (/opt/node_app/node_modules/express-session/index.js:485:11)\n at Layer.handle [as handle_request] (/opt/node_app/node_modules/express/lib/router/layer.js:95:5)\n at trim_prefix (/opt/node_app/node_modules/express/lib/router/index.js:328:13)\n at /opt/node_app/node_modules/express/lib/router/index.js:286:9\n at Function.process_params (/opt/node_app/node_modules/express/lib/router/index.js:346:12)"}
"connect-redis": "^6.0.1",
"redis": "^4.6.5",
And with connect-redis 7, it crashes completely
"connect-redis": "^7.0.1",
"redis": "^4.6.5",
server-connect:setup:session init session store { '$type': 'redis', ttl: 86400000 } +0ms
TypeError: require(...) is not a function
at Object.<anonymous> (/opt/node_app/lib/setup/session.js:17:48)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object.<anonymous> (/opt/node_app/lib/server.js:21:17)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
[nodemon] clean exit - waiting for changes before restart