Prisma database with Prisma orm showing Cache skipped reason: (auto no cache)
Whenever I refresh the website it shows this - GET http://localhost:3000/api/auth/get-session 200 in 85ms (cache skip)
auth.js
import { betterAuth } from "better-auth";
import { prismaAdapter } from "better-auth/adapters/prisma";
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
export const auth = betterAuth({
database: prismaAdapter(prisma, {
provider: "postgresql"
}),
session: {
expiresIn: 60 * 60 * 24 * 7, // 7 days
updateAge: 60 * 60 * 24, // 1 day (every 1 day the session expiration is updated)
cookieCache: {
enabled: true,
maxAge: 5 * 60 // Cache duration in seconds
}
},
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
},
},
})
Solution:Jump to solution
I'm not quite sure if I understand what the issue is here but to get session from a cookie cache, it would still need to hit your API.
2 Replies
Solution
I'm not quite sure if I understand what the issue is here but to get session from a cookie cache, it would still need to hit your API.
Oh okay understood. Actually prisma api was also hitting! Thankyou understood!