next-auth icon indicating copy to clipboard operation
next-auth copied to clipboard

Support for generic Redis adapter

Open KalleV opened this issue 2 years ago • 5 comments
trafficstars

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

KalleV avatar Aug 10 '23 17:08 KalleV

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.

balazsorban44 avatar Aug 11 '23 10:08 balazsorban44

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.

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.

jokester avatar Aug 12 '23 12:08 jokester

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!

balazsorban44 avatar Aug 12 '23 21:08 balazsorban44

someone please submit a pr :)

jer-0 avatar Sep 09 '23 23:09 jer-0

I think it can be closed if the Unstorage adapter works well with Redis.

cay89 avatar Jul 23 '24 14:07 cay89

There's https://github.com/kane50613/redis-on-workers/ that can be used on the edge.

rishi-raj-jain avatar Mar 10 '25 08:03 rishi-raj-jain