next-auth
next-auth copied to clipboard
Support for generic Redis adapter
Description 📓
Hi team! Great project! I'm curious if there's any interest in developing an adapter for generic Redis connections that could work with Redis or Google Memory Store. I was able to adapt the Upstash Redis adapter into a custom Redis using "ioredis" as the Node.js client but it seems like an adapter that could benefit the Auth.js community. I have used https://github.com/tj/connect-redis extensively before for Node.js sessions and this could fit a similar use case.
How to reproduce ☕️
References:
- https://authjs.dev/reference/adapter/upstash-redis
- https://ably.com/blog/migrating-from-node-redis-to-ioredis
Contributing 🙌🏽
Yes, I am willing to help implement this feature in a PR
Is there a Redis client that only relies on Web Standard APIs, ie. not Node.js-only? AFAICT, both redis and ioredis are advertised as Node.js libraries. This would make the adapter not ideal for Edge runtimes, where Redis would really shine.
Is there a Redis client that only relies on Web Standard APIs, ie. not Node.js-only? AFAICT, both
redisandioredisare advertised as Node.js libraries. This would make the adapter not ideal for Edge runtimes, where Redis would really shine.
A conventional Redis server speaks in TCP, but Web standards don't have this capability yet. I guess an edge runtime need to provide some extra API, be it standardized or vendor-specific, to make it possible.
Right. Upstash uses fetch I believe. In that case, it's going to be a caveat of this adapter but happy to accept a PR for it!
someone please submit a pr :)
I think it can be closed if the Unstorage adapter works well with Redis.
There's https://github.com/kane50613/redis-on-workers/ that can be used on the edge.