Really loving the work you're putting into this and it really shows.
With V3 gaining traction I wanted to start migrating my app over, but setting up prisma in combination with redis is tripping me up.
This is my current set-up for getting my auth configuration
/**
* Returns a Lucia instance with the appropriate adapter and middleware based on the environment.
* If the environment is development, it uses a Redis session adapter with a local Redis instance.
* If the environment is production, it uses a Redis session adapter with an Upstash Redis instance.
*/
async function getConfiguration() {
if (isDev) {
const sessionAdapter = await import('@lucia-auth/adapter-session-redis');
const Redis = await import('redis');
console.warn('Using dev redis');
const redisClient = Redis.createClient({
url: REDIS_URL
});
redisClient.connect();
redisClient.on('error', (err) => console.error('Redis Client Error', err));
redisClient.on('ready', () => console.warn('Redis Client Ready'));
const adapter = new PrismaAdapter(sessionAdapter.redis(redisClient), db.user);
return new Lucia(adapter, {
sessionCookie: {
attributes: {
// set to `true` when using HTTPSđ
secure: !isDev
}
}
});
} else {
const sessionAdapter = await import('@lucia-auth/adapter-session-redis');
const Redis = await import('@upstash/redis/cloudflare');
console.warn('Using prod redis');
const adapter = new PrismaAdapter(
sessionAdapter.upstash(
new Redis.Redis({
url: REDIS_URL,
token: REDIS_TOKEN
})
),
db.user
);
return new Lucia(adapter, {
sessionCookie: {
attributes: {
// set to `true` when using HTTPS
secure: !isDev
}
}
});
}
}
But when I launch the app I get
TypeError: this.sessionModel.findUnique is not a function
at PrismaAdapter.getSessionAndUser (file:///home/dle/DevWork/me/whatsin.fyi/node_modules/.pnpm/@lucia-auth+adapter-prisma@4.0.1_@prisma+client@5.7.1_lucia@3.1.1/node_modules/@lucia-auth/adapter-prisma/dist/index.js:29:48)
I'm not sure how to set up the prisma adapter with redis anymore. I've tried setting it up without a session model by passing null into it, but that didn't get me anywhere.
The V2 docs had some good guides on this and I was wondering what the V3 recommended approach to this is?
closing this because apparently redis sessions are no longer supported. There are a myriad of reasons why they should be, but I'm fairly sure that this discussion has been had ad infinitum already.
Description
Hi
Really loving the work you're putting into this and it really shows.
With V3 gaining traction I wanted to start migrating my app over, but setting up prisma in combination with redis is tripping me up.
This is my current set-up for getting my auth configuration
But when I launch the app I get
I'm not sure how to set up the prisma adapter with redis anymore. I've tried setting it up without a session model by passing null into it, but that didn't get me anywhere.
The V2 docs had some good guides on this and I was wondering what the V3 recommended approach to this is?