Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(auth): Cannot read properties of undefined, GoogleProfile.hd (#3019)

Lucas Magnume6b9d23615a0
diff --git a/web/src/server/auth.ts b/web/src/server/auth.ts
index 2156858227..20fd186d80 100644
--- a/web/src/server/auth.ts
+++ b/web/src/server/auth.ts
@@ -445,10 +445,11 @@ export async function getAuthOptions(): Promise<NextAuthOptions> {
env.AUTH_GOOGLE_ALLOWED_DOMAINS?.split(",").map((domain) =>
domain.trim().toLowerCase(),
) ?? [];
+
if (allowedDomains.length > 0) {
return await Promise.resolve(
allowedDomains.includes(
- (profile as GoogleProfile).hd.toLowerCase(),
+ (profile as GoogleProfile).hd?.toLowerCase(),
),
);
}