-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔧 fix(redis): Resolve Redis Standalone vs Cluster mode discrepancy for social logins #2848
🔧 fix(redis): Resolve Redis Standalone vs Cluster mode discrepancy for social logins #2848
Conversation
781a06a
to
f47edf9
Compare
Thank you! |
Ah yes, you're right. That's my fault -- the event handlers should be added only if |
@arthurian I reverted the changes and adding this to prevent wall of errors, let me know if this change works for you. This might be the most optimal solution if it does. It makes sense to use different clients for separate purposes |
Actually made an error, here is the updated commit: 0f42793 |
Yeah, that would work for us. The only addendum I would suggest is to make sure the Redis standalone client is passed in to new RedisStore({ client, prefix: 'librechat' }); To: new RedisStore({ client: redis, prefix: 'librechat' }); |
Actually nvm, I saw in your updated commit 0f42793 you renamed |
Summary
Resolves an issue with OpenID authentication requests hanging and timing out when using Redis in Standalone mode (see also #2843).
Steps to reproduce:
USE_REDIS
andREDIS_URI
env vars.ALLOW_SOCIAL_LOGIN
andOPENID_*
env vars.This issue can be traced to the way social logins are configured at startup, since a
RedisStore
is configured for session storage with the client fromapi/cache/redis.js
, but this client assumes that Redis is running in Cluster mode, and as a result it fails to connect (times out). The connection error is silently ignored, so it doesn't show up in the log output. By contrast, theapi/cache/keyvRedis.js
client successfully connects to Redis in Standalone mode and reportsRedis initialized
.As it stands, neither
redis.js
norkeyvRedis.js
support Cluster mode and doing so would require introducing additional configuration and logic, so the proposed fix is to resolve the immediate discrepancy to ensure that both work with Redis in Standalone mode. The suggestions proposed in #2843 to support Cluster mode could be considered for a subsequent enhancement.Change Type
Testing
Test Configuration:
I have confirmed that the proposed updates work with an AWS ElasticCache Redis installation running in Standalone mode. There's no additional configuration required to test this besides setting the environment variables to use redis and OpenID authentication.
Test Script:
The following script adapted from
api/cache/redis.js
can be used to show the problem whenREDIS_URI
points to a Standalone installation:The following output is expected when running the script:
Checklist