diff --git a/services/workflows-service/src/auth/local/local-auth.guard.ts b/services/workflows-service/src/auth/local/local-auth.guard.ts index 39c1167f13..de3df712d5 100644 --- a/services/workflows-service/src/auth/local/local-auth.guard.ts +++ b/services/workflows-service/src/auth/local/local-auth.guard.ts @@ -11,11 +11,14 @@ export class LocalAuthGuard extends AuthGuard('local') implements CanActivate { async canActivate(context: ExecutionContext): Promise { const result = super.canActivate(context) as boolean; const request = context.switchToHttp().getRequest(); + if (result && request.user) { const fullUrl = request.protocol + '://' + request.get('host') + request.originalUrl; this.supabaseService.logSignIn(fullUrl); } + super.logIn(request); + return Promise.resolve(result); } } diff --git a/services/workflows-service/src/supabase/supabase.service.ts b/services/workflows-service/src/supabase/supabase.service.ts index caa34e8620..6795b527cd 100644 --- a/services/workflows-service/src/supabase/supabase.service.ts +++ b/services/workflows-service/src/supabase/supabase.service.ts @@ -17,6 +17,7 @@ export class SupabaseService implements ISupabaseService { const telemetryEnabled = this.configService.get('TELEMETRY_ENABLED'); const supabaseUrl = this.configService.get('TELEMETRY_SUPABASE_URL'); const supabaseApiKey = this.configService.get('TELEMETRY_SUPABASE_API_KEY'); + if (telemetryEnabled) { if (!supabaseUrl || !supabaseApiKey) { throw new Error('Supabase URL or API key is missing in configuration');