{"record":{"id":"2f93bd7f4015d6da","repo":"Stirling-Tools/Stirling-PDF","slug":"error-message","errorCode":null,"errorMessage":"error.message","messagePattern":"error\\.message","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/editor/src/saas/routes/signup/AuthService.ts","lineNumber":19,"sourceCode":"import { supabase } from \"@app/auth/supabase\";\nimport { absoluteWithBasePath } from \"@app/constants/app\";\n\nexport const useAuthService = () => {\n  const signUp = async (email: string, password: string, name?: string) => {\n    console.log(\"[Signup] Creating account for:\", email);\n\n    const { data, error } = await supabase.auth.signUp({\n      email: email.trim(),\n      password: password,\n      options: {\n        emailRedirectTo: absoluteWithBasePath(\"/auth/callback\"),\n        data: { full_name: name },\n      },\n    });\n\n    if (error) {\n      console.error(\"[Signup] Sign up error:\", error);\n      throw new Error(error.message);\n    }\n\n    if (data.user) {\n      console.log(\"[Signup] Sign up successful:\", data.user);\n      return {\n        user: data.user,\n        session: data.session,\n        requiresEmailConfirmation: data.user && !data.session,\n      };\n    }\n\n    throw new Error(\"Unknown error occurred during signup\");\n  };\n\n  const signInWithProvider = async (\n    provider: \"github\" | \"google\" | \"apple\" | \"azure\",\n  ) => {\n    const { error } = await supabase.auth.signInWithOAuth({","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/Stirling-Tools/Stirling-PDF/blob/9ef20dcab80b85041912f045e17a6aea1d08f969/frontend/editor/src/saas/routes/signup/AuthService.ts#L1-L37","documentation":"Thrown by AuthService.signUp() when supabase.auth.signUp() returns an error object. The error.message is propagated directly. Supabase auth errors cover duplicate email registration, weak password, invalid email format, rate limiting, and auth-service-disabled scenarios. This is the primary signup failure path.","triggerScenarios":"User registers with an email that already exists ('User already registered'); password doesn't meet the configured minimum length; email fails Supabase validation; the Supabase project has email auth disabled; rate limit exceeded.","commonSituations":"Duplicate email signup attempt; password too short (Supabase default min 6 chars but configurable); typo in email; Supabase auth rate limiting on repeated attempts.","solutions":["Read error.message for the specific Supabase auth error to determine the exact cause","Validate email format and password strength client-side before calling signUp","For 'User already registered', offer a sign-in or password-reset flow instead","Check Supabase Dashboard > Authentication > Settings for minimum password length and email confirmation requirements"],"exampleFix":"// before\nconst { data, error } = await supabase.auth.signUp({ ... });\nif (error) {\n  throw new Error(error.message);\n}\n\n// after (in the caller)\ntry {\n  await signUp(email, password, name);\n} catch (e) {\n  if (e.message.includes('already registered')) {\n    showSignInPrompt(email);\n  } else {\n    setError(e.message);\n  }\n}","handlingStrategy":"validation","validationCode":"// Validate email and password before calling signUp\nif (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email)) {\n  throw new Error('Please enter a valid email address');\n}\nif (password.length < 6) {\n  throw new Error('Password must be at least 6 characters');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const result = await signUp(email, password, name);\n  if (result.requiresEmailConfirmation) {\n    showEmailConfirmationPrompt(email);\n  }\n} catch (e) {\n  const msg = e instanceof Error ? e.message : 'Sign up failed';\n  if (msg.includes('already registered')) {\n    redirectToSignIn(email);\n  } else {\n    setFormError(msg);\n  }\n}","preventionTips":["Validate email format and password strength client-side before calling supabase.auth.signUp","Check for duplicate emails with a lightweight lookup if available before full signup","Map known Supabase error messages to user-friendly guidance (e.g. 'already registered' → sign-in prompt)"],"tags":["auth","signup","supabase","validation","saas"],"backgroundTag":null,"analyzedSha":"9ef20dcab80b85041912f045e17a6aea1d08f969","analyzedAt":"2026-08-13T22:11:39.827Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}