Skip to content

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

feat(auth): capture unexpected credential sign-in errors

Marc Klingene543c7dc27bc
diff --git a/web/src/pages/auth/sign-in.tsx b/web/src/pages/auth/sign-in.tsx
index e1f8f3c237..bb318d8c64 100644
--- a/web/src/pages/auth/sign-in.tsx
+++ b/web/src/pages/auth/sign-in.tsx
@@ -225,22 +225,28 @@ export default function SignIn({ authProviders, signUpDisabled }: PageProps) {
values: z.infer<typeof credentialAuthForm>,
) {
setCredentialsFormError(null);
- capture("sign_in:button_click", { provider: "email/password" });
- const result = await signIn("credentials", {
- email: values.email,
- password: values.password,
- callbackUrl: "/",
- redirect: false,
- turnstileToken,
- });
- if (result?.error) {
- setCredentialsFormError(result.error);
+ try {
+ capture("sign_in:button_click", { provider: "email/password" });
+ const result = await signIn("credentials", {
+ email: values.email,
+ password: values.password,
+ callbackUrl: "/",
+ redirect: false,
+ turnstileToken,
+ });
+ if (result?.error) {
+ setCredentialsFormError(result.error);
- // Refresh turnstile as the token can only be used once
- if (env.NEXT_PUBLIC_TURNSTILE_SITE_KEY && turnstileToken) {
- setTurnstileCData(new Date().getTime().toString());
- setTurnstileToken(undefined);
+ // Refresh turnstile as the token can only be used once
+ if (env.NEXT_PUBLIC_TURNSTILE_SITE_KEY && turnstileToken) {
+ setTurnstileCData(new Date().getTime().toString());
+ setTurnstileToken(undefined);
+ }
}
+ } catch (error) {
+ captureException(error);
+ console.error(error);
+ setCredentialsFormError("An unexpected error occurred.");
}
}