diff --git a/src/lib/components/domains/nameserverTable.svelte b/src/lib/components/domains/nameserverTable.svelte
index a08de42080..66c7c165d0 100644
--- a/src/lib/components/domains/nameserverTable.svelte
+++ b/src/lib/components/domains/nameserverTable.svelte
@@ -3,8 +3,15 @@
import { Badge, Layout, Typography, Table, InteractiveText } from '@appwrite.io/pink-svelte';
- export let domain: string;
- export let verified = undefined;
+ let {
+ domain,
+ verified,
+ ruleStatus
+ }: {
+ domain: string;
+ verified?: boolean;
+ ruleStatus?: 'created' | 'verifying' | 'unverified' | 'verified';
+ } = $props();
const nameserverList = $regionalConsoleVariables?._APP_DOMAINS_NAMESERVERS
? $regionalConsoleVariables?._APP_DOMAINS_NAMESERVERS?.split(',')
@@ -16,14 +23,24 @@
{domain}
- {#if verified === true}
-
- {:else if verified === false}
-
+ {#if verified !== undefined}
+ {#if ruleStatus === 'created'}
+
+ {:else if ruleStatus === 'verifying'}
+
+ {:else if ruleStatus === 'unverified'}
+
+ {:else if verified === true}
+
+ {/if}
{/if}
- Add the following nameservers on your DNS provider. Note that changes may take up to 48
+ Add the following nameservers on your DNS provider. Note that DNS changes may take up to 48
hours to propagate fully.
diff --git a/src/lib/components/domains/recordTable.svelte b/src/lib/components/domains/recordTable.svelte
index 6dc145e35d..dd0c305e74 100644
--- a/src/lib/components/domains/recordTable.svelte
+++ b/src/lib/components/domains/recordTable.svelte
@@ -14,10 +14,10 @@
let {
domain,
- verified = undefined,
+ verified,
variant,
service = 'general',
- ruleStatus = undefined,
+ ruleStatus,
onNavigateToNameservers = () => {},
onNavigateToA = () => {},
onNavigateToAAAA = () => {}
@@ -115,7 +115,9 @@
{variant.toUpperCase()}
- {subdomain || '@'}
+
+
+
diff --git a/src/routes/(console)/organization-[organization]/domains/+page.svelte b/src/routes/(console)/organization-[organization]/domains/+page.svelte
index ec6c271e0a..477786e8f8 100644
--- a/src/routes/(console)/organization-[organization]/domains/+page.svelte
+++ b/src/routes/(console)/organization-[organization]/domains/+page.svelte
@@ -93,9 +93,9 @@
{#if !isDomainVerified(domain)}
+ size="xs" />
{/if}
{:else if column.id === 'registrar'}
diff --git a/src/routes/(console)/organization-[organization]/domains/add-domain/+page.svelte b/src/routes/(console)/organization-[organization]/domains/add-domain/+page.svelte
index c6953c2e3e..a1066a09a8 100644
--- a/src/routes/(console)/organization-[organization]/domains/add-domain/+page.svelte
+++ b/src/routes/(console)/organization-[organization]/domains/add-domain/+page.svelte
@@ -1,6 +1,7 @@
@@ -125,7 +117,7 @@
- {data.proxyRule.domain}
+ {proxyRule.domain}
@@ -172,14 +164,17 @@
{#if selectedTab === 'nameserver'}
-
+
{:else}
(selectedTab = 'nameserver')}
onNavigateToA={() => (selectedTab = 'a')}
onNavigateToAAAA={() => (selectedTab = 'aaaa')} />
diff --git a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/recordsCard.svelte b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/recordsCard.svelte
index 07a2da2c42..55e9b5a95e 100644
--- a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/recordsCard.svelte
+++ b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/recordsCard.svelte
@@ -25,8 +25,8 @@
- Add the following nameservers on your DNS provider. Note that changes may take
- up to 48 hours to propagate fully.
+ Add the following nameservers on your DNS provider. Note that DNS changes may
+ take up to 48 hours to propagate fully.
diff --git a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/retryDomainModal.svelte b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/retryDomainModal.svelte
index 391321a9b3..bc90344d66 100644
--- a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/retryDomainModal.svelte
+++ b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/retryDomainModal.svelte
@@ -13,13 +13,16 @@
import { Divider, Tabs } from '@appwrite.io/pink-svelte';
import NameserverTable from '$lib/components/domains/nameserverTable.svelte';
import RecordTable from '$lib/components/domains/recordTable.svelte';
+ import { getApexDomain } from '$lib/helpers/tlds';
let {
show = $bindable(false),
- selectedProxyRule
+ selectedProxyRule,
+ domainsList
}: {
show: boolean;
selectedProxyRule: Models.ProxyRule;
+ domainsList?: Models.DomainsList;
} = $props();
const showCNAMETab = $derived(
@@ -40,43 +43,42 @@
let selectedTab = $state<'cname' | 'nameserver' | 'a' | 'aaaa'>(getDefaultTab());
let error = $state(null);
- let verified = $state(false);
+ let verified: boolean | undefined = $state(undefined);
function getDefaultTab() {
return showCNAMETab ? 'cname' : showATab ? 'a' : showAAAATab ? 'aaaa' : 'nameserver';
}
async function retryProxyRule() {
+ error = null;
+ verified = undefined;
+
try {
- error = null;
- const proxyRule = await sdk
+ const apexDomain = getApexDomain(selectedProxyRule.domain);
+ const domain = domainsList?.domains.find((d) => d.domain === apexDomain);
+ if (isCloud && domain) {
+ await sdk.forConsole.domains.updateNameservers({
+ domainId: domain.$id
+ });
+ }
+ } catch {
+ // Ignore error
+ }
+
+ try {
+ selectedProxyRule = await sdk
.forProject(page.params.region, page.params.project)
.proxy.updateRuleVerification({ ruleId: selectedProxyRule.$id });
- verified = proxyRule.status === 'verified';
await invalidate(Dependencies.FUNCTION_DOMAINS);
-
- // This means domain verification using DNS records hasn't succeeded and the rule is still in initial state.
- if (proxyRule.status === 'created') {
- throw new Error(
- 'Domain verification failed. Please check your domain settings or try again later'
- );
- }
-
- if (verified) {
- addNotification({
- type: 'success',
- message: `${selectedProxyRule.domain} has been verified`
- });
- } else {
- addNotification({
- type: 'info',
- message: 'Verification in progress'
- });
- }
show = false;
+ addNotification({
+ type: 'success',
+ message: 'Domain verified successfully'
+ });
trackEvent(Submit.DomainUpdateVerification);
} catch (e) {
+ verified = false;
error =
e.message ??
'Domain verification failed. Please check your domain settings or try again later';
@@ -130,7 +132,10 @@
{#if selectedTab === 'nameserver'}
-
+
{:else}
([
title: 'Domain',
type: 'string',
format: 'string',
- width: { min: 300 }
+ width: { min: 600 }
},
{
id: 'target',
title: 'Target',
type: 'string',
- width: { min: 120, max: 400 }
+ width: { min: 160, max: 400 }
},
{
diff --git a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/table.svelte b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/table.svelte
index 83daf1ffe0..6f16935717 100644
--- a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/table.svelte
+++ b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/table.svelte
@@ -222,7 +222,7 @@
{/if}
{#if showRetry}
-
+
{/if}
{#if showLogs}
diff --git a/src/routes/(console)/project-[region]-[project]/settings/domains/add-domain/+page.svelte b/src/routes/(console)/project-[region]-[project]/settings/domains/add-domain/+page.svelte
index 2f4250d19f..eb2b2a214f 100644
--- a/src/routes/(console)/project-[region]-[project]/settings/domains/add-domain/+page.svelte
+++ b/src/routes/(console)/project-[region]-[project]/settings/domains/add-domain/+page.svelte
@@ -30,16 +30,24 @@
async function addDomain() {
const apexDomain = getApexDomain(domainName);
- let domain = data.domainsList.domains.find((d: Models.Domain) => d.domain === apexDomain);
+ const domain = data.domainsList.domains.find((d: Models.Domain) => d.domain === apexDomain);
if (apexDomain && !domain && isCloud) {
try {
- domain = await sdk.forConsole.domains.create({
+ await sdk.forConsole.domains.create({
teamId: $project.teamId,
domain: apexDomain
});
} catch (error) {
- // Apex domain creation error needs to be silent.
+ // apex might already be added on organization level, skip.
+ const alreadyAdded = error?.type === 'domain_already_exists';
+ if (!alreadyAdded) {
+ addNotification({
+ type: 'error',
+ message: error.message
+ });
+ return;
+ }
}
}
@@ -47,12 +55,18 @@
const rule = await sdk
.forProject(page.params.region, page.params.project)
.proxy.createAPIRule({ domain: domainName.toLocaleLowerCase() });
- if (rule?.status === 'verified') {
+
+ await invalidate(Dependencies.DOMAINS);
+
+ const verified = rule?.status !== 'created';
+ if (verified) {
+ addNotification({
+ type: 'success',
+ message: 'Domain verified successfully'
+ });
await goto(routeBase);
- await invalidate(Dependencies.DOMAINS);
} else {
await goto(`${routeBase}/add-domain/verify-${domainName}?rule=${rule.$id}`);
- await invalidate(Dependencies.DOMAINS);
}
} catch (error) {
addNotification({
diff --git a/src/routes/(console)/project-[region]-[project]/settings/domains/add-domain/verify-[domain]/+page.svelte b/src/routes/(console)/project-[region]-[project]/settings/domains/add-domain/verify-[domain]/+page.svelte
index f0312de382..93f725eb0f 100644
--- a/src/routes/(console)/project-[region]-[project]/settings/domains/add-domain/verify-[domain]/+page.svelte
+++ b/src/routes/(console)/project-[region]-[project]/settings/domains/add-domain/verify-[domain]/+page.svelte
@@ -11,7 +11,6 @@
} from '@appwrite.io/pink-svelte';
import { Button, Form } from '$lib/elements/forms';
import { sdk } from '$lib/stores/sdk';
- import { organization } from '$lib/stores/organization';
import { addNotification } from '$lib/stores/notifications';
import { goto, invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
@@ -23,6 +22,7 @@
import NameserverTable from '$lib/components/domains/nameserverTable.svelte';
import RecordTable from '$lib/components/domains/recordTable.svelte';
import { regionalConsoleVariables } from '$routes/(console)/project-[region]-[project]/store';
+ import { getApexDomain } from '$lib/helpers/tlds.js';
let { data } = $props();
@@ -44,8 +44,8 @@
);
const showNSTab = isCloud;
+ let proxyRule = $derived(data.proxyRule);
let selectedTab = $state<'cname' | 'nameserver' | 'a' | 'aaaa'>(getDefaultTab());
-
const routeBase = `${base}/project-${page.params.region}-${page.params.project}/settings/domains`;
let verified: boolean | undefined = $state(undefined);
const isSubmitting = writable(false);
@@ -55,43 +55,31 @@
}
async function verify() {
- const isNewDomain =
- data.domainsList.domains.find((rule) => rule.domain === data.proxyRule.domain) ===
- undefined;
- try {
- if (selectedTab !== 'nameserver') {
- const ruleData = await sdk
- .forProject(page.params.region, page.params.project)
- .proxy.updateRuleVerification({ ruleId });
- verified = ruleData.status === 'verified';
+ verified = undefined;
- // This means domain verification using DNS records hasn't succeeded and the rule is still in initial state.
- if (ruleData.status === 'created') {
- throw new Error(
- 'Domain verification failed. Please check your domain settings or try again later'
- );
- }
- } else if (isNewDomain && isCloud) {
- const domainData = await sdk.forConsole.domains.create({
- teamId: $organization.$id,
- domain: data.proxyRule.domain
+ try {
+ const apexDomain = getApexDomain(proxyRule.domain);
+ const domain = data.domainsList.domains.find((d) => d.domain === apexDomain);
+ if (isCloud && domain) {
+ await sdk.forConsole.domains.updateNameservers({
+ domainId: domain.$id
});
- verified = domainData.nameservers.toLowerCase() === 'appwrite';
}
+ } catch (error) {
+ // Ignore error
+ }
+
+ try {
+ proxyRule = await sdk
+ .forProject(page.params.region, page.params.project)
+ .proxy.updateRuleVerification({ ruleId });
- if (verified) {
- addNotification({
- type: 'success',
- message: 'Domain added successfully'
- });
- } else {
- addNotification({
- type: 'info',
- message: 'Verification in progress'
- });
- }
- await goto(routeBase);
await invalidate(Dependencies.DOMAINS);
+ await goto(routeBase);
+ addNotification({
+ type: 'success',
+ message: 'Domain verified successfully'
+ });
} catch (error) {
verified = false;
isSubmitting.set(false);
@@ -108,7 +96,7 @@
.forProject(page.params.region, page.params.project)
.proxy.deleteRule({ ruleId });
}
- await goto(`${routeBase}/add-domain?domain=${data.proxyRule.domain}`);
+ await goto(`${routeBase}/add-domain?domain=${proxyRule.domain}`);
}
@@ -125,7 +113,7 @@
- {data.proxyRule.domain}
+ {proxyRule.domain}
@@ -172,14 +160,17 @@
{#if selectedTab === 'nameserver'}
-
+
{:else}
(selectedTab = 'nameserver')}
onNavigateToA={() => (selectedTab = 'a')}
onNavigateToAAAA={() => (selectedTab = 'aaaa')} />
diff --git a/src/routes/(console)/project-[region]-[project]/settings/domains/retryDomainModal.svelte b/src/routes/(console)/project-[region]-[project]/settings/domains/retryDomainModal.svelte
index bd77890a83..1098b8d3fb 100644
--- a/src/routes/(console)/project-[region]-[project]/settings/domains/retryDomainModal.svelte
+++ b/src/routes/(console)/project-[region]-[project]/settings/domains/retryDomainModal.svelte
@@ -13,13 +13,16 @@
import { Divider, Tabs } from '@appwrite.io/pink-svelte';
import NameserverTable from '$lib/components/domains/nameserverTable.svelte';
import RecordTable from '$lib/components/domains/recordTable.svelte';
+ import { getApexDomain } from '$lib/helpers/tlds';
let {
show = $bindable(),
- selectedProxyRule
+ selectedProxyRule,
+ domainsList
}: {
show: boolean;
selectedProxyRule: Models.ProxyRule;
+ domainsList?: Models.DomainsList;
} = $props();
const showCNAMETab = $derived(
@@ -40,43 +43,42 @@
let selectedTab = $state<'cname' | 'nameserver' | 'a' | 'aaaa'>(getDefaultTab());
let error = $state(null);
- let verified = $state(false);
+ let verified: boolean | undefined = $state(undefined);
function getDefaultTab() {
return showCNAMETab ? 'cname' : showATab ? 'a' : showAAAATab ? 'aaaa' : 'nameserver';
}
async function retryDomain() {
+ error = null;
+ verified = undefined;
+
try {
- error = null;
- const proxyRule = await sdk
+ const apexDomain = getApexDomain(selectedProxyRule.domain);
+ const domain = domainsList?.domains.find((d) => d.domain === apexDomain);
+ if (isCloud && domain) {
+ await sdk.forConsole.domains.updateNameservers({
+ domainId: domain.$id
+ });
+ }
+ } catch {
+ // Ignore error
+ }
+
+ try {
+ selectedProxyRule = await sdk
.forProject(page.params.region, page.params.project)
.proxy.updateRuleVerification({ ruleId: selectedProxyRule.$id });
- verified = proxyRule.status === 'verified';
await invalidate(Dependencies.DOMAINS);
-
- // This means domain verification using DNS records hasn't succeeded and the rule is still in initial state.
- if (proxyRule.status === 'created') {
- throw new Error(
- 'Domain verification failed. Please check your domain settings or try again later'
- );
- }
-
- if (verified) {
- addNotification({
- type: 'success',
- message: `${selectedProxyRule.domain} has been verified`
- });
- } else {
- addNotification({
- type: 'info',
- message: 'Verification in progress'
- });
- }
show = false;
+ addNotification({
+ type: 'success',
+ message: 'Domain verified successfully'
+ });
trackEvent(Submit.DomainUpdateVerification);
} catch (e) {
+ verified = false;
error =
e.message ??
'Domain verification failed. Please check your domain settings or try again later';
@@ -130,7 +132,10 @@
{#if selectedTab === 'nameserver'}
-
+
{:else}
+
{/if}
{#if showLogs}
diff --git a/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/add-domain/+page.svelte b/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/add-domain/+page.svelte
index b4288a1f90..90f8c679d2 100644
--- a/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/add-domain/+page.svelte
+++ b/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/add-domain/+page.svelte
@@ -58,16 +58,24 @@
async function addDomain() {
const apexDomain = getApexDomain(domainName);
const isSiteDomain = domainName.endsWith($regionalConsoleVariables._APP_DOMAIN_SITES);
- let domain = data.domainsList.domains.find((d) => d.domain === apexDomain);
+ const domain = data.domainsList.domains.find((d) => d.domain === apexDomain);
if (isCloud && apexDomain && !domain && !isSiteDomain) {
try {
- domain = await sdk.forConsole.domains.create({
+ await sdk.forConsole.domains.create({
teamId: $project.teamId,
domain: apexDomain
});
} catch (error) {
- // Apex domain creation error needs to be silent.
+ // apex might already be added on organization level, skip.
+ const alreadyAdded = error?.type === 'domain_already_exists';
+ if (!alreadyAdded) {
+ addNotification({
+ type: 'error',
+ message: error.message
+ });
+ return;
+ }
}
}
@@ -99,12 +107,18 @@
siteId: page.params.site
});
}
- if (rule?.status === 'verified') {
+
+ await invalidate(Dependencies.SITES_DOMAINS);
+
+ const verified = rule?.status !== 'created';
+ if (verified) {
+ addNotification({
+ type: 'success',
+ message: 'Domain verified successfully'
+ });
await goto(routeBase);
- await invalidate(Dependencies.SITES_DOMAINS);
} else {
await goto(`${routeBase}/add-domain/verify-${domainName}?rule=${rule.$id}`);
- await invalidate(Dependencies.SITES_DOMAINS);
}
} catch (error) {
addNotification({
diff --git a/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/add-domain/verify-[domain]/+page.svelte b/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/add-domain/verify-[domain]/+page.svelte
index 80fba1842c..83eb4f33da 100644
--- a/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/add-domain/verify-[domain]/+page.svelte
+++ b/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/add-domain/verify-[domain]/+page.svelte
@@ -11,7 +11,6 @@
} from '@appwrite.io/pink-svelte';
import { Button, Form } from '$lib/elements/forms';
import { sdk } from '$lib/stores/sdk';
- import { organization } from '$lib/stores/organization';
import { addNotification } from '$lib/stores/notifications';
import { goto, invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
@@ -23,6 +22,7 @@
import RecordTable from '$lib/components/domains/recordTable.svelte';
import NameserverTable from '$lib/components/domains/nameserverTable.svelte';
import { regionalConsoleVariables } from '$routes/(console)/project-[region]-[project]/store';
+ import { getApexDomain } from '$lib/helpers/tlds.js';
let { data } = $props();
@@ -44,6 +44,7 @@
);
const showNSTab = isCloud;
+ let proxyRule = $derived(data.proxyRule);
let selectedTab = $state<'cname' | 'nameserver' | 'a' | 'aaaa'>(getDefaultTab());
let routeBase = `${base}/project-${page.params.region}-${page.params.project}/sites/site-${page.params.site}/domains`;
let verified: boolean | undefined = $state(undefined);
@@ -54,44 +55,34 @@
}
async function verify() {
- const isNewDomain =
- data.domainsList.domains.findIndex((rule) => rule.domain === data.proxyRule.domain) ===
- -1;
- try {
- if (selectedTab !== 'nameserver') {
- const ruleData = await sdk
- .forProject(page.params.region, page.params.project)
- .proxy.updateRuleVerification({ ruleId });
- verified = ruleData.status === 'verified';
+ verified = undefined;
- // This means domain verification using DNS records hasn't succeeded and the rule is still in initial state.
- if (ruleData.status === 'created') {
- throw new Error(
- 'Domain verification failed. Please check your domain settings or try again later'
- );
- }
- } else if (isNewDomain && isCloud) {
- const domainData = await sdk.forConsole.domains.create({
- teamId: $organization.$id,
- domain: data.proxyRule.domain
+ try {
+ const apexDomain = getApexDomain(proxyRule.domain);
+ const domain = data.domainsList.domains.find((d) => d.domain === apexDomain);
+ if (isCloud && domain) {
+ await sdk.forConsole.domains.updateNameservers({
+ domainId: domain.$id
});
- verified = domainData.nameservers.toLowerCase() === 'appwrite';
}
+ } catch (error) {
+ // Ignore error
+ }
- if (verified) {
- addNotification({
- type: 'success',
- message: 'Domain added successfully'
- });
- } else {
- addNotification({
- type: 'info',
- message: 'Verification in progress'
- });
- }
+ try {
+ proxyRule = await sdk
+ .forProject(page.params.region, page.params.project)
+ .proxy.updateRuleVerification({ ruleId });
+
+ await Promise.all([
+ invalidate(Dependencies.DOMAINS),
+ invalidate(Dependencies.SITES_DOMAINS)
+ ]);
await goto(routeBase);
- await invalidate(Dependencies.DOMAINS);
- await invalidate(Dependencies.SITES_DOMAINS);
+ addNotification({
+ type: 'success',
+ message: 'Domain verified successfully'
+ });
} catch (error) {
verified = false;
isSubmitting.set(false);
@@ -108,7 +99,7 @@
.forProject(page.params.region, page.params.project)
.proxy.deleteRule({ ruleId });
}
- await goto(`${routeBase}/add-domain?domain=${data.proxyRule.domain}`);
+ await goto(`${routeBase}/add-domain?domain=${proxyRule.domain}`);
}
@@ -125,7 +116,7 @@
- {data.proxyRule.domain}
+ {proxyRule.domain}
@@ -172,14 +163,17 @@
{#if selectedTab === 'nameserver'}
-
+
{:else}
(selectedTab = 'nameserver')}
onNavigateToA={() => (selectedTab = 'a')}
onNavigateToAAAA={() => (selectedTab = 'aaaa')} />
diff --git a/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/retryDomainModal.svelte b/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/retryDomainModal.svelte
index 6e36ac2ec4..56fa02b6dc 100644
--- a/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/retryDomainModal.svelte
+++ b/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/retryDomainModal.svelte
@@ -13,13 +13,16 @@
import NameserverTable from '$lib/components/domains/nameserverTable.svelte';
import RecordTable from '$lib/components/domains/recordTable.svelte';
import { regionalConsoleVariables } from '$routes/(console)/project-[region]-[project]/store';
+ import { getApexDomain } from '$lib/helpers/tlds';
let {
show = $bindable(false),
- selectedProxyRule
+ selectedProxyRule,
+ domainsList
}: {
show: boolean;
selectedProxyRule: Models.ProxyRule;
+ domainsList?: Models.DomainsList;
} = $props();
const showCNAMETab = $derived(
@@ -40,43 +43,42 @@
let selectedTab = $state<'cname' | 'nameserver' | 'a' | 'aaaa'>(getDefaultTab());
let error = $state(null);
- let verified = $state(false);
+ let verified: boolean | undefined = $state(undefined);
function getDefaultTab() {
return showCNAMETab ? 'cname' : showATab ? 'a' : showAAAATab ? 'aaaa' : 'nameserver';
}
async function retryDomain() {
+ error = null;
+ verified = undefined;
+
try {
- error = null;
- const proxyRule = await sdk
+ const apexDomain = getApexDomain(selectedProxyRule.domain);
+ const domain = domainsList?.domains.find((d) => d.domain === apexDomain);
+ if (isCloud && domain) {
+ await sdk.forConsole.domains.updateNameservers({
+ domainId: domain.$id
+ });
+ }
+ } catch {
+ // Ignore error
+ }
+
+ try {
+ selectedProxyRule = await sdk
.forProject(page.params.region, page.params.project)
.proxy.updateRuleVerification({ ruleId: selectedProxyRule.$id });
- verified = proxyRule.status === 'verified';
await invalidate(Dependencies.SITES_DOMAINS);
-
- // This means domain verification using DNS records hasn't succeeded and the rule is still in initial state.
- if (proxyRule.status === 'created') {
- throw new Error(
- 'Domain verification failed. Please check your domain settings or try again later'
- );
- }
-
- if (verified) {
- addNotification({
- type: 'success',
- message: `${selectedProxyRule.domain} has been verified`
- });
- } else {
- addNotification({
- type: 'info',
- message: 'Verification in progress'
- });
- }
show = false;
+ addNotification({
+ type: 'success',
+ message: 'Domain verified successfully'
+ });
trackEvent(Submit.DomainUpdateVerification);
} catch (e) {
+ verified = false;
error =
e.message ??
'Domain verification failed. Please check your domain settings or try again later';
@@ -130,7 +132,10 @@
{#if selectedTab === 'nameserver'}
-
+
{:else}
([
title: 'Domain',
type: 'string',
format: 'string',
- width: { min: 300 }
+ width: { min: 600 }
},
{
id: 'target',
title: 'Target',
type: 'string',
- width: { min: 120, max: 400 }
+ width: { min: 160, max: 400 }
},
{
diff --git a/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/table.svelte b/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/table.svelte
index a3921aeaa1..b1a1b4447e 100644
--- a/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/table.svelte
+++ b/src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/table.svelte
@@ -222,7 +222,7 @@
{/if}
{#if showRetry}
-
+
{/if}
{#if showLogs}