@@ -5,7 +5,7 @@ import { getToken } from "@src/utils/auth/callbacks/get-token";
55import { getUpdatedSession } from "@src/utils/auth/callbacks/get-updated-session" ;
66import { isValidSignIn } from "@src/utils/auth/callbacks/is-valid-signin" ;
77import { MaxAgeInSeconds } from "@src/utils/auth/types" ;
8- import { AppConfig , configProvider } from "@src/utils/config" ;
8+ import lazyConfig from "@src/utils/lazy- config" ;
99import { logger } from "@src/utils/logger" ;
1010import { profilePerformanceEnd , profilePerformanceStart } from "@src/utils/performance" ;
1111import { RequestContext , asyncLocalStorage } from "@src/utils/requestContext" ;
@@ -21,8 +21,7 @@ const AuthJWTPerformanceMarker = "auth-jwt-callback";
2121const AuthSessionPerformanceMarker = "auth-session-callback" ;
2222
2323export const { handlers, signIn, signOut, auth } = NextAuth ( async ( ) => {
24- const config : AppConfig = await configProvider ( ) ;
25- const MAX_SESSION_AGE_SECONDS : number = config . MAX_SESSION_AGE_MINUTES * 60 ;
24+ const MAX_SESSION_AGE_SECONDS : number = ( ( await lazyConfig . MAX_SESSION_AGE_MINUTES ) as number ) * 60 ;
2625 const headerValues = await headers ( ) ;
2726
2827 const requestContext : RequestContext = extractRequestContextFromHeaders ( headerValues ) ;
@@ -48,7 +47,7 @@ export const { handlers, signIn, signOut, auth } = NextAuth(async () => {
4847 let response : boolean ;
4948 try {
5049 profilePerformanceStart ( AuthSignInPerformanceMarker ) ;
51- response = isValidSignIn ( account , config ) ;
50+ response = await isValidSignIn ( account ) ;
5251 profilePerformanceEnd ( AuthSignInPerformanceMarker ) ;
5352 } catch ( error ) {
5453 log . error ( { error : error } , "signIn() callback error" ) ;
@@ -63,7 +62,7 @@ export const { handlers, signIn, signOut, auth } = NextAuth(async () => {
6362 let response ;
6463 try {
6564 profilePerformanceStart ( AuthJWTPerformanceMarker ) ;
66- response = getToken ( token , account , profile , config , MAX_SESSION_AGE_SECONDS as MaxAgeInSeconds ) ;
65+ response = getToken ( token , account , profile , MAX_SESSION_AGE_SECONDS as MaxAgeInSeconds ) ;
6766 profilePerformanceEnd ( AuthJWTPerformanceMarker ) ;
6867 } catch ( error ) {
6968 log . error ( { error : error } , "jwt() callback error" ) ;
0 commit comments