From 06a9336db276f294760881e4a677e622da559d7e Mon Sep 17 00:00:00 2001 From: Tofik Hasanov Date: Wed, 18 Mar 2026 11:37:30 -0400 Subject: [PATCH] feat(trust-portal): enhance domain verification process with Vercel API integration - Added logic to trigger Vercel domain verification for SSL provisioning, ensuring domains are active without manual intervention. - Updated verification checks to account for Vercel domains, improving the accuracy of the verification process. - Introduced error handling for Vercel API calls to log warnings without failing the domain verification flow. --- .../src/trust-portal/trust-portal.service.ts | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/apps/api/src/trust-portal/trust-portal.service.ts b/apps/api/src/trust-portal/trust-portal.service.ts index 048dd9ada..f6c1975c1 100644 --- a/apps/api/src/trust-portal/trust-portal.service.ts +++ b/apps/api/src/trust-portal/trust-portal.service.ts @@ -993,8 +993,11 @@ export class TrustPortalService { }); } + const requiresVercelTxt = trustRecord?.isVercelDomain === true; const isVerified = - isCnameVerified && isTxtVerified && isVercelTxtVerified; + isCnameVerified && + isTxtVerified && + (!requiresVercelTxt || isVercelTxtVerified); if (!isVerified) { return { @@ -1017,6 +1020,24 @@ export class TrustPortalService { }, }); + // Trigger Vercel to re-verify the domain so it provisions SSL and starts serving. + // Without this, Vercel doesn't know DNS has been configured and the domain stays inactive + // (previously required CS to manually click "Refresh" in Vercel dashboard). + if (process.env.TRUST_PORTAL_PROJECT_ID && process.env.VERCEL_TEAM_ID) { + try { + await this.vercelApi.post( + `/v9/projects/${process.env.TRUST_PORTAL_PROJECT_ID}/domains/${domain}/verify`, + {}, + { params: { teamId: process.env.VERCEL_TEAM_ID } }, + ); + } catch (error) { + // Non-fatal — domain is verified on our side, Vercel will eventually pick it up + this.logger.warn( + `Failed to trigger Vercel domain verification for ${domain}: ${error}`, + ); + } + } + return { success: true, isCnameVerified,