Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: check for CAA errors (#12090)

Div Arora2514cd62dada
diff --git a/studio/components/interfaces/Settings/General/CustomDomainConfig/CustomDomainVerify.tsx b/studio/components/interfaces/Settings/General/CustomDomainConfig/CustomDomainVerify.tsx
index 1314aaa2e03..3e6c8b0c35c 100644
--- a/studio/components/interfaces/Settings/General/CustomDomainConfig/CustomDomainVerify.tsx
+++ b/studio/components/interfaces/Settings/General/CustomDomainConfig/CustomDomainVerify.tsx
@@ -1,7 +1,7 @@
import Link from 'next/link'
import { useState } from 'react'
import { observer } from 'mobx-react-lite'
-import { Button, IconAlertCircle, IconExternalLink, IconHelpCircle, IconRefreshCw } from 'ui'
+import { Alert, Button, IconAlertCircle, IconExternalLink, IconHelpCircle, IconRefreshCw } from 'ui'
import { useStore } from 'hooks'
import { ProjectSettingsResponse } from 'data/config/project-settings-query'
@@ -20,7 +20,6 @@ export type CustomDomainVerifyProps = {
const CustomDomainVerify = ({ projectRef, customDomain, settings }: CustomDomainVerifyProps) => {
const { ui } = useStore()
-
const [isNotVerifiedYet, setIsNotVerifiedYet] = useState(false)
const { mutate: reverifyCustomDomain, isLoading: isReverifyLoading } =
@@ -29,9 +28,13 @@ const CustomDomainVerify = ({ projectRef, customDomain, settings }: CustomDomain
if (res.status === '2_initiated') setIsNotVerifiedYet(true)
},
})
-
const { mutateAsync: deleteCustomDomain, isLoading: isDeleting } = useCustomDomainDeleteMutation()
+ const hasCAAErrors = customDomain.ssl.validation_errors?.reduce(
+ (acc, error) => acc || error.message.includes('caa_error'),
+ false
+ )
+
const onReverifyCustomDomain = () => {
if (!projectRef) {
throw new Error('Project ref is required')
@@ -111,6 +114,18 @@ const CustomDomainVerify = ({ projectRef, customDomain, settings }: CustomDomain
</div>
</div>
+ {hasCAAErrors && (
+ <Alert
+ withIcon
+ variant="warning"
+ title="Certificate Authority Authentication (CAA) error"
+ >
+ Please add a CAA record allowing "digicert.com" to issue certificates for{' '}
+ <code className="text-xs">{customDomain.hostname}</code>. For example:{' '}
+ <code className="text-xs">0 issue "digitcert.com"</code>
+ </Alert>
+ )}
+
<div className="space-y-2">
<div className="flex gap-4">
<div className="w-[50px]">
diff --git a/studio/data/custom-domains/custom-domains-query.ts b/studio/data/custom-domains/custom-domains-query.ts
index 182e701a7da..8d5f4f2ea14 100644
--- a/studio/data/custom-domains/custom-domains-query.ts
+++ b/studio/data/custom-domains/custom-domains-query.ts
@@ -39,6 +39,9 @@ type Ssl = {
txt_name: string
txt_value: string
}[]
+ validation_errors?: {
+ message: string
+ }[]
}
type OwnershipVerification = {