Scheduling infrastructure for absolutely everyone.
fix: improve Vercel domain 'forbidden' error message and add schema fields (#25520)
Hariom Balharab80c0692dc77
diff --git a/packages/lib/domainManager/deploymentServices/vercel.ts b/packages/lib/domainManager/deploymentServices/vercel.tsindex 46d295be86f..27ff4b1311d 100644--- a/packages/lib/domainManager/deploymentServices/vercel.ts+++ b/packages/lib/domainManager/deploymentServices/vercel.ts@@ -12,6 +12,8 @@ const vercelDomainApiResponseSchema = z.object({.object({code: z.string().nullish(),domain: z.any().nullish(),+ message: z.string().nullish(),+ invalidToken: z.boolean().nullish(),}).optional(),});@@ -74,10 +76,16 @@ export const deleteDomain = async (domain: string) => {return handleDomainDeletionError(data.error);};-function handleDomainCreationError(error: { code?: string | null; domain?: string | null }) {- // Domain is already owned by another team but you can request delegation to access it+function handleDomainCreationError(error: {+ code?: string | null;+ domain?: string | null;+ message?: string | null;+ invalidToken?: boolean | null;+}){+ // Vercel returns "forbidden" for various permission issues, not just domain ownershipif (error.code === "forbidden") {- const errorMessage = "Domain is already owned by another team";+ const errorMessage =+ "Vercel denied permission to manage this domain. Please verify your Vercel project, team, and domain permissions.";log.error(safeStringify({errorMessage,@@ -117,15 +125,21 @@ function handleDomainCreationError(error: { code?: string | null; domain?: strin});}-function handleDomainDeletionError(error: { code?: string | null; domain?: string | null }) {+function handleDomainDeletionError(error: {+ code?: string | null;+ domain?: string | null;+ message?: string | null;+ invalidToken?: boolean | null;+}){if (error.code === "not_found") {// Domain is already deletedreturn true;}- // Domain is already owned by another team but you can request delegation to access it+ // Vercel returns "forbidden" for various permission issues, not just domain ownershipif (error.code === "forbidden") {- const errorMessage = "Domain is owned by another team";+ const errorMessage =+ "Vercel denied permission to manage this domain. Please verify your Vercel project, team, and domain permissions.";log.error(safeStringify({errorMessage,