fix(frontend): say the database is missing, not Supabase
Independent Staging Quality Gate / validate (push) Successful in 9m34s
Independent Staging Quality Gate / publish (push) Successful in 7m21s

Self-hosted PostgreSQL is the runtime. A missing APP_DATABASE_URL
must not tell users the retired hosted service is unconfigured.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-08-29 09:44:53 +08:00
co-authored by Cursor
parent 3198fb6b2b
commit 31b54aa71d
22 changed files with 90 additions and 28 deletions
+2 -2
View File
@@ -161,7 +161,7 @@ export async function GET() {
});
} catch (error) {
if (isSupabaseConfigurationError(error)) {
return NextResponse.json({ error: "Supabase 尚未配置", code: "SUPABASE_NOT_CONFIGURED" }, { status: 503 });
return NextResponse.json({ error: "数据库尚未配置", code: "DATABASE_NOT_CONFIGURED" }, { status: 503 });
}
return NextResponse.json({ error: "账户服务暂时不可用" }, { status: 500 });
}
@@ -346,7 +346,7 @@ export async function PATCH(request: Request) {
});
} catch (error) {
if (isSupabaseConfigurationError(error)) {
return NextResponse.json({ error: "Supabase 尚未配置", code: "SUPABASE_NOT_CONFIGURED" }, { status: 503 });
return NextResponse.json({ error: "数据库尚未配置", code: "DATABASE_NOT_CONFIGURED" }, { status: 503 });
}
return NextResponse.json({ error: "账户服务暂时不可用" }, { status: 500 });
}
@@ -42,7 +42,7 @@ export async function POST(request: Request) {
} catch (error) {
if (isSupabaseConfigurationError(error)) {
return NextResponse.json(
{ error: "服务尚未配置", message: "请先配置 Supabase 环境变量。" },
{ error: "服务尚未配置", message: "请先配置数据库环境变量。" },
{ status: 503 },
);
}
@@ -63,7 +63,7 @@ export async function POST(request: Request) {
} catch (error) {
if (isSupabaseConfigurationError(error)) {
return NextResponse.json(
{ error: "服务尚未配置", message: "请先配置 Supabase 环境变量。" },
{ error: "服务尚未配置", message: "请先配置数据库环境变量。" },
{ status: 503 },
);
}
@@ -31,7 +31,7 @@ export async function DELETE(_request: Request, context: RouteContext) {
return NextResponse.json({ ok: true });
} catch (error) {
if (isSupabaseConfigurationError(error)) {
return NextResponse.json({ error: "Supabase 尚未配置", code: "SUPABASE_NOT_CONFIGURED" }, { status: 503 });
return NextResponse.json({ error: "数据库尚未配置", code: "DATABASE_NOT_CONFIGURED" }, { status: 503 });
}
return NextResponse.json({ error: errorMessage(error, "星盘删除失败") }, { status: 500 });
}
+2 -2
View File
@@ -28,7 +28,7 @@ export async function GET() {
return NextResponse.json({ profiles: data ?? [] });
} catch (error) {
if (isSupabaseConfigurationError(error)) {
return NextResponse.json({ error: "Supabase 尚未配置", code: "SUPABASE_NOT_CONFIGURED" }, { status: 503 });
return NextResponse.json({ error: "数据库尚未配置", code: "DATABASE_NOT_CONFIGURED" }, { status: 503 });
}
return NextResponse.json({ error: errorMessage(error, "星盘库暂时不可用") }, { status: 500 });
}
@@ -81,7 +81,7 @@ export async function POST(request: Request) {
return NextResponse.json({ profile: data });
} catch (error) {
if (isSupabaseConfigurationError(error)) {
return NextResponse.json({ error: "Supabase 尚未配置", code: "SUPABASE_NOT_CONFIGURED" }, { status: 503 });
return NextResponse.json({ error: "数据库尚未配置", code: "DATABASE_NOT_CONFIGURED" }, { status: 503 });
}
return NextResponse.json({ error: errorMessage(error, "星盘保存失败") }, { status: 500 });
}
+1 -1
View File
@@ -18,7 +18,7 @@ export async function POST(request: Request) {
accounting = createAdminSupabaseClient();
} catch {
return NextResponse.json(
{ error: "服务尚未配置", message: "请先配置 Supabase 环境变量。" },
{ error: "服务尚未配置", message: "请先配置数据库环境变量。" },
{ status: 503 },
);
}
+1 -1
View File
@@ -234,7 +234,7 @@ export async function POST(request: Request) {
accounting = createAdminSupabaseClient();
} catch {
return NextResponse.json(
{ error: "服务尚未配置", message: "请先配置 Supabase 环境变量。" },
{ error: "服务尚未配置", message: "请先配置数据库环境变量。" },
{ status: 503 },
);
}
+1 -1
View File
@@ -11,7 +11,7 @@ export async function GET() {
} catch (error) {
if (error instanceof Error) {
return NextResponse.json(
{ error: "服务尚未配置", message: "请先配置 Supabase 环境变量。" },
{ error: "服务尚未配置", message: "请先配置数据库环境变量。" },
{ status: 503 },
);
}
+1 -1
View File
@@ -42,7 +42,7 @@ export async function GET() {
} catch (error) {
if (isSupabaseConfigurationError(error)) {
return NextResponse.json(
{ error: "Supabase 尚未配置", code: "SUPABASE_NOT_CONFIGURED" },
{ error: "数据库尚未配置", code: "DATABASE_NOT_CONFIGURED" },
{ status: 503 },
);
}
+1 -1
View File
@@ -75,7 +75,7 @@ export async function POST(request: Request) {
} catch (error) {
if (isSupabaseConfigurationError(error)) {
return NextResponse.json(
{ error: "Supabase 尚未配置", code: "SUPABASE_NOT_CONFIGURED" },
{ error: "数据库尚未配置", code: "DATABASE_NOT_CONFIGURED" },
{ status: 503 },
);
}
@@ -80,7 +80,7 @@ export async function GET(request: Request, context: RouteContext) {
} catch (error) {
if (isSupabaseConfigurationError(error)) {
return NextResponse.json(
{ error: "Supabase 尚未配置", code: "SUPABASE_NOT_CONFIGURED" },
{ error: "数据库尚未配置", code: "DATABASE_NOT_CONFIGURED" },
{ status: 503 },
);
}
@@ -122,7 +122,7 @@ export async function DELETE(request: Request, context: RouteContext) {
} catch (error) {
if (isSupabaseConfigurationError(error)) {
return NextResponse.json(
{ error: "Supabase 尚未配置", code: "SUPABASE_NOT_CONFIGURED" },
{ error: "数据库尚未配置", code: "DATABASE_NOT_CONFIGURED" },
{ status: 503 },
);
}
+2 -2
View File
@@ -93,7 +93,7 @@ export async function GET() {
} catch (error) {
if (isSupabaseConfigurationError(error)) {
return NextResponse.json(
{ error: "Supabase 尚未配置", code: "SUPABASE_NOT_CONFIGURED" },
{ error: "数据库尚未配置", code: "DATABASE_NOT_CONFIGURED" },
{ status: 503 },
);
}
@@ -211,7 +211,7 @@ export async function POST(request: Request) {
} catch (error) {
if (isSupabaseConfigurationError(error)) {
return NextResponse.json(
{ error: "Supabase 尚未配置", code: "SUPABASE_NOT_CONFIGURED" },
{ error: "数据库尚未配置", code: "DATABASE_NOT_CONFIGURED" },
{ status: 503 },
);
}
+2 -2
View File
@@ -51,7 +51,7 @@ export async function PATCH(request: Request, context: RouteContext) {
return NextResponse.json({ error: error.message }, { status: 413 });
}
if (isSupabaseConfigurationError(error)) {
return NextResponse.json({ error: "Supabase 尚未配置", code: "SUPABASE_NOT_CONFIGURED" }, { status: 503 });
return NextResponse.json({ error: "数据库尚未配置", code: "DATABASE_NOT_CONFIGURED" }, { status: 503 });
}
return NextResponse.json({ error: "聊天记录暂时无法同步" }, { status: 500 });
}
@@ -74,7 +74,7 @@ export async function DELETE(_request: Request, context: RouteContext) {
return NextResponse.json({ ok: true });
} catch (error) {
if (isSupabaseConfigurationError(error)) {
return NextResponse.json({ error: "Supabase 尚未配置", code: "SUPABASE_NOT_CONFIGURED" }, { status: 503 });
return NextResponse.json({ error: "数据库尚未配置", code: "DATABASE_NOT_CONFIGURED" }, { status: 503 });
}
return NextResponse.json({ error: error instanceof Error ? error.message : "删除聊天记录失败" }, { status: 500 });
}
+1 -1
View File
@@ -52,7 +52,7 @@ export async function POST(request: Request) {
return NextResponse.json({ error: error.message }, { status: 413 });
}
if (isSupabaseConfigurationError(error)) {
return NextResponse.json({ error: "Supabase 尚未配置", code: "SUPABASE_NOT_CONFIGURED" }, { status: 503 });
return NextResponse.json({ error: "数据库尚未配置", code: "DATABASE_NOT_CONFIGURED" }, { status: 503 });
}
return NextResponse.json({ error: "聊天记录暂时无法同步" }, { status: 500 });
}
@@ -36,7 +36,7 @@ export async function GET() {
return NextResponse.json({ reports: data ?? [] });
} catch (error) {
if (isSupabaseConfigurationError(error)) {
return NextResponse.json({ error: "Supabase 尚未配置", code: "SUPABASE_NOT_CONFIGURED" }, { status: 503 });
return NextResponse.json({ error: "数据库尚未配置", code: "DATABASE_NOT_CONFIGURED" }, { status: 503 });
}
return NextResponse.json({ error: errorMessage(error, "合盘历史暂时不可用") }, { status: 500 });
}
@@ -78,7 +78,7 @@ export async function POST(request: Request) {
return NextResponse.json({ report: data });
} catch (error) {
if (isSupabaseConfigurationError(error)) {
return NextResponse.json({ error: "Supabase 尚未配置", code: "SUPABASE_NOT_CONFIGURED" }, { status: 503 });
return NextResponse.json({ error: "数据库尚未配置", code: "DATABASE_NOT_CONFIGURED" }, { status: 503 });
}
return NextResponse.json({ error: errorMessage(error, "合盘历史保存失败") }, { status: 500 });
}