{"record":{"id":"a923cbf9111405ce","repo":"Stirling-Tools/Stirling-PDF","slug":"sign-up-failed","errorCode":null,"errorMessage":"Sign up failed","messagePattern":"Sign up failed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/editor/src/desktop/services/authService.ts","lineNumber":305,"sourceCode":"\n    const redirectParam = encodeURIComponent(DESKTOP_DEEP_LINK_CALLBACK);\n    const signupUrl = `${STIRLING_SAAS_URL.replace(/\\/$/, \"\")}/auth/v1/signup?redirect_to=${redirectParam}`;\n\n    try {\n      const response = await axios.post(\n        signupUrl,\n        { email, password, email_redirect_to: DESKTOP_DEEP_LINK_CALLBACK },\n        {\n          headers: {\n            \"Content-Type\": \"application/json;charset=UTF-8\",\n            apikey: SUPABASE_KEY,\n            Authorization: `Bearer ${SUPABASE_KEY}`,\n          },\n        },\n      );\n\n      if (response.status >= 400) {\n        throw new Error(\"Sign up failed\");\n      }\n    } catch (error) {\n      if (axios.isAxiosError(error)) {\n        const message =\n          error.response?.data?.error_description ||\n          error.response?.data?.msg ||\n          error.response?.data?.message ||\n          error.message;\n        throw new Error(message || \"Sign up failed\", { cause: error });\n      }\n      throw error instanceof Error\n        ? error\n        : new Error(\"Sign up failed\", { cause: error });\n    }\n  }\n\n  async login(\n    serverUrl: string,","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/Stirling-Tools/Stirling-PDF/blob/9ef20dcab80b85041912f045e17a6aea1d08f969/frontend/editor/src/desktop/services/authService.ts#L287-L323","documentation":"Thrown in signUpSaas when response.status >= 400 after axios.post to the Supabase /auth/v1/signup endpoint. Note axios rejects on 4xx/5xx by default, so this explicit check is mostly a backstop for a customized validateStatus; the more common path is the catch block (error 99). It signals the Supabase signup endpoint returned an HTTP error.","triggerScenarios":"Supabase returns 400 (invalid email/password policy), 409/422 (user already exists), 429 (rate limited), or 5xx; apikey/Authorization header missing or wrong so Supabase rejects; STIRLING_SAAS_URL points to the wrong host; network returns an error status that bypassed axios's throw due to a validateStatus override.","commonSituations":"VITE_SUPABASE_PUBLISHABLE_DEFAULT_KEY misconfigured or rotated; SaaS URL env var pointing to a stale environment; password below Supabase's minimum strength; user re-registering an existing email.","solutions":["Verify VITE_SAAS_SERVER_URL and VITE_SUPABASE_PUBLISHABLE_DEFAULT_KEY are set and current (signUpSaas already checks presence, not validity).","Inspect the actual response body/status — log response.status and response.data to distinguish duplicate-user from rate-limit from auth-failure.","Since axios normally throws, rely on the catch path (error 99) for the real message and consider removing this redundant throw.","Enforce password/email format client-side before posting to reduce 4xx hits."],"exampleFix":"// before\nif (response.status >= 400) {\n  throw new Error(\"Sign up failed\");\n}\n\n// after\nif (response.status >= 400) {\n  const detail = response.data?.error_description || response.data?.msg || `HTTP ${response.status}`;\n  throw new Error(`Sign up failed: ${detail}`);\n}","handlingStrategy":"try-catch","validationCode":"if (!email || !/^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(email)) {\n  throw new Error(\"Enter a valid email address.\");\n}\nif (password.length < 8) {\n  throw new Error(\"Password must be at least 8 characters.\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  await authService.signUpSaas(email, password);\n} catch (error) {\n  const msg = (error as Error).message;\n  if (msg === \"Sign up failed\") {\n    // surface a generic retry UI; the detailed cause is in error.cause\n  }\n  throw error;\n}","preventionTips":["Validate email format and password strength client-side before posting.","Keep VITE_SUPABASE_PUBLISHABLE_DEFAULT_KEY and VITE_SAAS_SERVER_URL current.","Inspect response.status/response.data to distinguish duplicate-user from rate-limit from auth failure."],"tags":["network","auth","supabase","saas","desktop"],"backgroundTag":null,"analyzedSha":"9ef20dcab80b85041912f045e17a6aea1d08f969","analyzedAt":"2026-08-13T22:11:39.827Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}