0

I'm using express-session "^1.17.1" and connect-redis "^4.0.4", hosted on Heroku using heroku-redis.

As I write this, the redis memory is full due to a misconfiguration on the maxmemory-policy, which is currently set to noeviction, which means that errors will be thrown when the max memory is reached.

The problem is that the error is showing up on the logs, and the app is effectively unusable, but express-session seems to be completely unaware of this error.

When the user logs into the app, I have the following code inside a try/catch block

req.session.oauthInfo = json;
req.session.oauthSuccess = true;
req.session.cache = initCache();

This does not fail at all, but the memory-exceeded error shows up in the logs.

Ideally, the above code would throw an exception because it's not possible to write to the session.

Even more ideal, this should happen way earlier, when this code runs

app.use(sessionConfig);

The end goal is that the app should be aware that redis is full, so that I can display proper error messages, etc.

How can this be configured?

Pablo Gonzalez
  • 1,710
  • 3
  • 21
  • 36

0 Answers0