Compare commits

...

18 Commits

Author SHA1 Message Date
Nicholas Tindle
d89b84ba2b remove logs 2025-10-18 03:09:26 -05:00
Nicholas Tindle
4619b07945 try this 2025-10-18 02:53:34 -05:00
Nicholas Tindle
d43535e491 Update route.ts 2025-10-18 02:39:28 -05:00
Nicholas Tindle
a35914889a feat: turn off captcha 2025-10-18 02:36:26 -05:00
Nicholas Tindle
7c248f2d6e test: discable turnstile 2025-10-18 02:22:53 -05:00
Nicholas Tindle
d4a7ce3846 feat: aggressive logging 2025-10-18 02:16:46 -05:00
Nicholas Tindle
605a198c09 feat: add log? 2025-10-18 01:44:21 -05:00
Nicholas Tindle
a3389485a7 Merge branch 'hotfix/waitlist-error-display' of https://github.com/Significant-Gravitas/AutoGPT into hotfix/waitlist-error-display 2025-10-17 23:46:48 -05:00
Nicholas Tindle
cd439e912a fix: same thing 2025-10-17 23:37:56 -05:00
Nicholas Tindle
7b32290582 Merge branch 'dev' into hotfix/waitlist-error-display 2025-10-17 23:35:02 -05:00
Nicholas Tindle
e3137382c3 feat: add error code check 2025-10-17 23:33:31 -05:00
Nicholas Tindle
65f2c04ef1 fix: lint 2025-10-17 14:02:23 -05:00
Nicholas Tindle
865abdb9e0 fix(frontend): correct waitlist error detection in auth-code-error page
- Removed incorrect 403 error code check (Supabase doesn't send HTTP codes in OAuth redirects)
- Added isWaitlistErrorFromParams() utility for OAuth callback errors
- Now properly detects P0001 and waitlist errors from error_description parameter
- Consistent error detection across all auth flows

The auth-code-error page receives errors via URL hash parameters from
Supabase OAuth redirects, not HTTP status codes. This fix ensures we
check the error description content rather than expecting a 403 code
that would never be sent.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-17 13:46:20 -05:00
Nicholas Tindle
b59b200bd6 formatting 2025-10-17 13:40:49 -05:00
Nicholas Tindle
e7fb4cce5a fix: resolve merge conflicts 2025-10-17 13:23:58 -05:00
Nicholas Tindle
85e2aef6ad refactor(frontend): improve waitlist error detection with centralized utilities
- Created utility functions for robust waitlist error detection
- Added multiple fallback checks: P0001 error code, message text, and table reference
- Centralized logic in utils.ts to avoid duplication
- Added privacy-conscious logging that sanitizes email addresses
- More resilient detection that handles various Supabase error formats

The error detection now checks for:
1. PostgreSQL P0001 error code (primary indicator)
2. "not allowed to register" message from trigger
3. Reference to "allowed_users" table

This makes the waitlist check more reliable even if Supabase changes
how it formats PostgreSQL trigger errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-17 13:20:26 -05:00
Nicholas Tindle
85a8fb598e Apply suggestion from @Pwuts
Co-authored-by: Reinier van der Leer <pwuts@agpt.co>
2025-10-17 13:06:35 -05:00
Nicholas Tindle
ae20da8aaa fix(frontend): improve waitlist error display for users not on allowlist
- Updated EmailNotAllowedModal with clear waitlist CTA and helpful messaging
- Added "Join Waitlist" button that opens https://agpt.co/waitlist
- Fixed OAuth provider signup/login to properly display waitlist modal
- Enhanced auth-code-error page to detect and display waitlist errors
- Added helpful guidance about checking email and Discord support link
- Consistent waitlist error handling across all auth flows

Fixes OPEN-2794

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-17 12:37:03 -05:00
6 changed files with 45 additions and 40 deletions

View File

@@ -6,7 +6,7 @@ import { Button } from "@/components/atoms/Button/Button";
import { Text } from "@/components/atoms/Text/Text";
import { Card } from "@/components/atoms/Card/Card";
import { WaitlistErrorContent } from "@/components/auth/WaitlistErrorContent";
import { isWaitlistErrorFromParams } from "@/app/api/auth/utils";
import { isWaitlistError } from "@/app/api/auth/utils";
import { useRouter } from "next/navigation";
export default function AuthErrorPage() {
@@ -38,12 +38,9 @@ export default function AuthErrorPage() {
}
// Check if this is a waitlist/not allowed error
const isWaitlistError = isWaitlistErrorFromParams(
errorCode,
errorDescription,
);
const isWaitlistErr = isWaitlistError(errorCode, errorDescription);
if (isWaitlistError) {
if (isWaitlistErr) {
return (
<div className="flex h-screen items-center justify-center">
<Card className="w-full max-w-md p-8">

View File

@@ -20,6 +20,11 @@ export async function GET(request: Request) {
const { error } = await supabase.auth.exchangeCodeForSession(code);
// Keep minimal error logging for OAuth debugging if needed
if (error) {
console.error("OAuth code exchange failed:", error.message);
}
if (!error) {
try {
const api = new BackendAPI();

View File

@@ -59,6 +59,7 @@ export function useSignupPage() {
resetCaptcha();
return;
}
try {
const response = await fetch("/api/auth/provider", {
method: "POST",
@@ -149,6 +150,7 @@ export function useSignupPage() {
setShowNotAllowedModal(true);
return;
}
toast({
title: result?.error || "Signup failed",
variant: "destructive",

View File

@@ -33,7 +33,7 @@ export async function POST(request: Request) {
if (error) {
// Check for waitlist/allowlist error
if (isWaitlistError(error)) {
if (isWaitlistError(error?.code, error?.message)) {
logWaitlistError("OAuth Provider", error.message);
return NextResponse.json({ error: "not_allowed" }, { status: 403 });
}

View File

@@ -30,6 +30,7 @@ export async function POST(request: Request) {
turnstileToken ?? "",
"signup",
);
if (!captchaOk) {
return NextResponse.json(
{ error: "CAPTCHA verification failed. Please try again." },
@@ -49,7 +50,7 @@ export async function POST(request: Request) {
if (error) {
// Check for waitlist/allowlist error
if (isWaitlistError(error)) {
if (isWaitlistError(error?.code, error?.message)) {
logWaitlistError("Signup", error.message);
return NextResponse.json({ error: "not_allowed" }, { status: 403 });
}

View File

@@ -1,45 +1,45 @@
/**
* Checks if a Supabase auth error is related to the waitlist/allowlist
* Checks if an error is related to the waitlist/allowlist
*
* Can be used with either:
* - Error objects from Supabase auth operations: `isWaitlistError(error?.code, error?.message)`
* - URL parameters from OAuth callbacks: `isWaitlistError(errorCode, errorDescription)`
*
* The PostgreSQL trigger raises P0001 with message format:
* "The email address "email" is not allowed to register. Please contact support for assistance."
*
* @param error - The error object from Supabase auth operations
* @returns true if this is a waitlist/allowlist error
*/
export function isWaitlistError(error: any): boolean {
if (!error?.message) return false;
return (
error.message.includes("P0001") || // PostgreSQL custom error code
error.message.includes("not allowed to register") || // Trigger message
error.message.toLowerCase().includes("allowed_users") // Table reference
);
}
/**
* Checks if OAuth callback URL parameters indicate a waitlist error
*
* This is for the auth-code-error page which receives errors via URL hash params
* from Supabase OAuth redirects
*
* @param errorCode - The error_code parameter from the URL
* @param errorDescription - The error_description parameter from the URL
* @param code - Error code (e.g., "P0001", "unexpected_failure") or null
* @param message - Error message/description or null
* @returns true if this appears to be a waitlist/allowlist error
*/
export function isWaitlistErrorFromParams(
errorCode?: string | null,
errorDescription?: string | null,
export function isWaitlistError(
code?: string | null,
message?: string | null,
): boolean {
if (!errorDescription) return false;
// Check for explicit PostgreSQL trigger error code
if (code === "P0001") return true;
const description = errorDescription.toLowerCase();
if (!message) return false;
const lowerMessage = message.toLowerCase();
// Check for the generic database error that occurs during waitlist check
// This happens when Supabase wraps the PostgreSQL trigger error
if (
code === "unexpected_failure" &&
message === "Database error saving new user"
) {
return true;
}
// Check for various waitlist-related patterns in the message
return (
description.includes("p0001") || // PostgreSQL error code might be in description
description.includes("not allowed") ||
description.includes("waitlist") ||
description.includes("allowlist") ||
description.includes("allowed_users")
lowerMessage.includes("p0001") || // PostgreSQL error code in message
lowerMessage.includes("not allowed") || // Common waitlist message
lowerMessage.includes("waitlist") || // Explicit waitlist mention
lowerMessage.includes("allowlist") || // Explicit allowlist mention
lowerMessage.includes("allowed_users") || // Database table reference
lowerMessage.includes("not allowed to register") // Full trigger message
);
}