Better AuthBA
Better Auth13mo ago
dun

betterFetch response time is above 1s

Repo : https://github.com/laduniestu/better-next
Web : https://betternext.dun.gg

ORM Settings

js const prisma =
    globalForPrisma.prisma ??
    new PrismaClient({
      log: ['query', 'info', 'warn', 'error'],
    });


Auth Config

  session: {
    freshAge: 0,
    expiresIn: 60 * 60 * 24 * 3, 
    updateAge: 60 * 60 * 12, 
    cookieCache: {
      enabled: true,
      maxAge: 60 * 5, 
    },
  },


Middleware

  const cookies = request.headers.get("cookie");
  const startTime = Date.now();
  const { data: session } = await betterFetch<Session>(
    "/api/auth/get-session",
    {
      baseURL: env.NEXT_PUBLIC_APP_URL,
      headers: {
        cookie: cookies || "",
      },
    }
  );
  const endTime = Date.now();
  const duration = endTime - startTime;
  console.log(`____Get Session Time: ${duration}ms`);
  console.log(cookies);
Was this page helpful?
betterFetch response time is above 1s - Better Auth