From 1a35d60b3f7e644bdad8fe387f5d8e149dcd06c0 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 15 Jul 2026 20:56:44 +0000 Subject: [PATCH] fix: surface config check failures instead of reporting Valid Configuration A non-JSON config response for a verified domain returned null, which the dashboard rendered as a healthy 'Valid Configuration'. Return an error-marked object and map it to 'Unknown Error' before the healthy branches. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01EPCij3bxjq7PH4dcsZfX5V --- .../components/domains/use-domain-status.ts | 3 +++ packages/api/src/router/domain.ts | 24 ++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/apps/dashboard/src/components/domains/use-domain-status.ts b/apps/dashboard/src/components/domains/use-domain-status.ts index ef7959e3..01c02b8b 100644 --- a/apps/dashboard/src/components/domains/use-domain-status.ts +++ b/apps/dashboard/src/components/domains/use-domain-status.ts @@ -55,6 +55,9 @@ export function useDomainStatus(domain?: string) { if (verificationJson?.verified) { status = "Valid Configuration"; } + // config check failed (e.g. Vercel outage) — don't report healthy + } else if (configJson?.error) { + status = "Unknown Error"; } else if (configJson?.misconfigured) { status = "Invalid Configuration"; } else { diff --git a/packages/api/src/router/domain.ts b/packages/api/src/router/domain.ts index 4e083312..52ea6845 100644 --- a/packages/api/src/router/domain.ts +++ b/packages/api/src/router/domain.ts @@ -41,13 +41,19 @@ export const domainResponseSchema = z.object({ .optional(), }); +const vercelErrorSchema = z + .object({ + code: z.string(), + message: z.string(), + }) + .optional(); + const domainResponseWithErrorSchema = domainResponseSchema.extend({ - error: z - .object({ - code: z.string(), - message: z.string(), - }) - .optional(), + error: vercelErrorSchema, +}); + +const domainConfigWithErrorSchema = domainConfigResponseSchema.extend({ + error: vercelErrorSchema, }); export type DomainVerificationResponse = z.infer; @@ -91,9 +97,11 @@ export const domainRouter = createTRPCRouter({ ); const json = await parseVercelJson(data); if (json === null) { - return null; + return domainConfigWithErrorSchema.parse({ + error: { code: "internal_error", message: "Unexpected response" }, + }); } - const result = domainConfigResponseSchema.parse(json); + const result = domainConfigWithErrorSchema.parse(json); return result; }), verifyDomain: protectedProcedure -- 2.51.2