Stirling-Tools/Stirling-PDF · error · Error

Sign up failed

Error message

Sign up failed

What it means

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.

Source

Thrown at frontend/editor/src/desktop/services/authService.ts:305

    const redirectParam = encodeURIComponent(DESKTOP_DEEP_LINK_CALLBACK);
    const signupUrl = `${STIRLING_SAAS_URL.replace(/\/$/, "")}/auth/v1/signup?redirect_to=${redirectParam}`;

    try {
      const response = await axios.post(
        signupUrl,
        { email, password, email_redirect_to: DESKTOP_DEEP_LINK_CALLBACK },
        {
          headers: {
            "Content-Type": "application/json;charset=UTF-8",
            apikey: SUPABASE_KEY,
            Authorization: `Bearer ${SUPABASE_KEY}`,
          },
        },
      );

      if (response.status >= 400) {
        throw new Error("Sign up failed");
      }
    } catch (error) {
      if (axios.isAxiosError(error)) {
        const message =
          error.response?.data?.error_description ||
          error.response?.data?.msg ||
          error.response?.data?.message ||
          error.message;
        throw new Error(message || "Sign up failed", { cause: error });
      }
      throw error instanceof Error
        ? error
        : new Error("Sign up failed", { cause: error });
    }
  }

  async login(
    serverUrl: string,

View on GitHub (pinned to 9ef20dcab8)

Solutions

  1. Verify VITE_SAAS_SERVER_URL and VITE_SUPABASE_PUBLISHABLE_DEFAULT_KEY are set and current (signUpSaas already checks presence, not validity).
  2. Inspect the actual response body/status — log response.status and response.data to distinguish duplicate-user from rate-limit from auth-failure.
  3. Since axios normally throws, rely on the catch path (error 99) for the real message and consider removing this redundant throw.
  4. Enforce password/email format client-side before posting to reduce 4xx hits.

Example fix

// before
if (response.status >= 400) {
  throw new Error("Sign up failed");
}

// after
if (response.status >= 400) {
  const detail = response.data?.error_description || response.data?.msg || `HTTP ${response.status}`;
  throw new Error(`Sign up failed: ${detail}`);
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!email || !/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email)) {
  throw new Error("Enter a valid email address.");
}
if (password.length < 8) {
  throw new Error("Password must be at least 8 characters.");
}

Try / catch

try {
  await authService.signUpSaas(email, password);
} catch (error) {
  const msg = (error as Error).message;
  if (msg === "Sign up failed") {
    // surface a generic retry UI; the detailed cause is in error.cause
  }
  throw error;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Stirling-Tools/Stirling-PDF@9ef20dcab8 (2026-08-13). Data as JSON: /api/errors/a923cbf9111405ce. Report an issue: GitHub.