Skip to content

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

fix: custom domain issues in the generated docs (#22759)

Akash Hamirwasiae6b4fa84616e
diff --git a/apps/studio/components/interfaces/ProjectAPIDocs/ProjectAPIDocs.tsx b/apps/studio/components/interfaces/ProjectAPIDocs/ProjectAPIDocs.tsx
index 6143c0de31e..fd6a143b758 100644
--- a/apps/studio/components/interfaces/ProjectAPIDocs/ProjectAPIDocs.tsx
+++ b/apps/studio/components/interfaces/ProjectAPIDocs/ProjectAPIDocs.tsx
@@ -50,7 +50,7 @@ const ProjectAPIDocs = () => {
: 'SUPABASE_CLIENT_ANON_KEY'
const endpoint =
customDomainData?.customDomain?.status === 'active'
- ? `https://${customDomainData.customDomain?.hostname}/auth/v1/callback`
+ ? `https://${customDomainData.customDomain?.hostname}`
: `https://${data?.autoApiService.endpoint ?? ''}`
return (
diff --git a/apps/studio/pages/project/[ref]/api/index.tsx b/apps/studio/pages/project/[ref]/api/index.tsx
index 899fa9ef981..b9eec9a8bb6 100644
--- a/apps/studio/pages/project/[ref]/api/index.tsx
+++ b/apps/studio/pages/project/[ref]/api/index.tsx
@@ -7,6 +7,7 @@ import { GeneralContent, ResourceContent, RpcContent } from 'components/interfac
import LangSelector from 'components/interfaces/Docs/LangSelector'
import { DocsLayout } from 'components/layouts'
import { useProjectApiQuery } from 'data/config/project-api-query'
+import { useCustomDomainsQuery } from 'data/custom-domains/custom-domains-query'
import { useProjectJsonSchemaQuery } from 'data/docs/project-json-schema-query'
import { snakeToCamel } from 'lib/helpers'
import type { NextPageWithLayout } from 'types'
@@ -79,6 +80,7 @@ const DocView = observer(() => {
error: jsonSchemaError,
refetch,
} = useProjectJsonSchemaQuery({ projectRef })
+ const { data: customDomainData } = useCustomDomainsQuery({ projectRef })
useEffect(() => {
PageState.setJsonSchema(jsonSchema)
@@ -104,10 +106,15 @@ const DocView = observer(() => {
</div>
)
+ const endpoint =
+ customDomainData?.customDomain?.status === 'active'
+ ? `https://${customDomainData.customDomain?.hostname}`
+ : `${data.autoApiService.protocol ?? 'https'}://${data.autoApiService.endpoint ?? '-'}`
+
// Data Loaded
const autoApiService = {
...data.autoApiService,
- endpoint: `${data.autoApiService.protocol ?? 'https'}://${data.autoApiService.endpoint ?? '-'}`,
+ endpoint,
}
const { paths, definitions } = PageState.jsonSchema