Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix: custom domains fixes
Richie McIlroy99796be71ab0
diff --git a/apps/web/app/api/settings/workspace/domain/route.ts b/apps/web/app/api/settings/workspace/domain/route.tsindex 823212c93..bd6e8f712 100644--- a/apps/web/app/api/settings/workspace/domain/route.ts+++ b/apps/web/app/api/settings/workspace/domain/route.ts@@ -78,8 +78,43 @@ const addDomain = async (domain: string) => {const getRequiredConfig = async (domain: string) => {console.log(`[Required Config] Fetching required config for domain: ${domain}`);++ // First try to get the records directly+ try {+ const recordsResponse = await fetch(+ `https://api.vercel.com/v4/domains/${domain.toLowerCase()}/records?limit=10&teamId=${process.env.VERCEL_TEAM_ID}`,+ {+ method: "GET",+ headers: {+ Authorization: `Bearer ${process.env.VERCEL_AUTH_TOKEN}`,+ "Content-Type": "application/json",+ },+ cache: "no-store"+ },+ ).then((res) => res.json());++ console.log(`[Required Config] Records Response:`, recordsResponse);++ if (recordsResponse.records) {+ const aRecord = recordsResponse.records.find((record: any) =>+ record.type === 'A' && record.name === ''+ );++ if (aRecord) {+ return {+ configuredBy: 'vercel',+ aValues: [aRecord.value],+ serviceType: 'vercel',+ };+ }+ }+ } catch (error) {+ console.error('[Required Config] Error fetching records:', error);+ }++ // Fallback to the old config endpointconst response = await fetch(- `https://vercel.com/api/v6/domains/${domain.toLowerCase()}/config?strict=true&teamId=${process.env.VERCEL_TEAM_ID}`,+ `https://api.vercel.com/v6/domains/${domain.toLowerCase()}/config?teamId=${process.env.VERCEL_TEAM_ID}`,{method: "GET",headers: {@@ -89,7 +124,30 @@ const getRequiredConfig = async (domain: string) => {cache: "no-store"},).then((res) => res.json());- console.log(`[Required Config] Response:`, response);+ console.log(`[Required Config] Fallback Response:`, response);++ // If we still don't have the A record, try the project domains endpoint+ if (!response.aValues || response.aValues.length === 0) {+ const projectResponse = await fetch(+ `https://api.vercel.com/v9/projects/${process.env.VERCEL_PROJECT_ID}/domains?teamId=${process.env.VERCEL_TEAM_ID}`,+ {+ method: "GET",+ headers: {+ Authorization: `Bearer ${process.env.VERCEL_AUTH_TOKEN}`,+ "Content-Type": "application/json",+ },+ cache: "no-store"+ },+ ).then((res) => res.json());++ if (projectResponse.domains) {+ const projectDomain = projectResponse.domains.find((d: any) => d.name === domain);+ if (projectDomain?.apexValue) {+ response.aValues = [projectDomain.apexValue];+ }+ }+ }+return response;};diff --git a/apps/web/app/dashboard/settings/workspace/components/CustomDomain.tsx b/apps/web/app/dashboard/settings/workspace/components/CustomDomain.tsxindex 3e722186e..9dbb976b6 100644--- a/apps/web/app/dashboard/settings/workspace/components/CustomDomain.tsx+++ b/apps/web/app/dashboard/settings/workspace/components/CustomDomain.tsx@@ -483,11 +483,26 @@ export function CustomDomain() {(value, index) => (<divkey={index}- className="flex items-center gap-2"+ className={+ value === domainConfig.requiredAValue+ ? "flex items-center gap-2 text-green-600"+ : "flex items-center gap-2 text-red-600"+ }>- <code className="bg-gray-50 px-2 py-1 rounded">+ <code+ className={+ value === domainConfig.requiredAValue+ ? "px-2 py-1 rounded bg-green-50"+ : "px-2 py-1 rounded bg-red-50"+ }+ >{value}</code>+ {value === domainConfig.requiredAValue && (+ <span className="text-xs text-green-600">+ (Correct)+ </span>+ )}</div>))}@@ -500,24 +515,29 @@ export function CustomDomain() {</dt><dd className="flex items-center gap-2"><div className="flex items-center gap-1.5 bg-gray-50 px-2 py-1 rounded flex-1 min-w-0">- <code className="text-sm text-green-600">- {domainConfig.requiredAValue}+ <code className="text-sm text-gray-900">+ {domainConfig.requiredAValue || "Loading..."}</code>- <button- type="button"- onClick={() =>- domainConfig.requiredAValue &&- handleCopy(domainConfig.requiredAValue, "value")- }- className="p-1 hover:bg-gray-100 rounded-md transition-colors shrink-0"- title="Copy to clipboard"- >- {copiedField === "value" ? (- <Check className="h-4 w-4 text-green-500" />- ) : (- <Copy className="h-4 w-4 text-gray-500" />- )}- </button>+ {domainConfig.requiredAValue && (+ <button+ type="button"+ onClick={() =>+ domainConfig.requiredAValue &&+ handleCopy(+ domainConfig.requiredAValue,+ "value"+ )+ }+ className="p-1 hover:bg-gray-100 rounded-md transition-colors shrink-0"+ title="Copy to clipboard"+ >+ {copiedField === "value" ? (+ <Check className="h-4 w-4 text-green-500" />+ ) : (+ <Copy className="h-4 w-4 text-gray-500" />+ )}+ </button>+ )}</div></dd></div>