The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat(hooks): update default edge function url (#18186)
Greg Richardson90ae844a0bc7
diff --git a/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx b/studio/components/interfaces/Database/Hooks/EditHookPanel.tsxindex a897d1b13d4..221f9f011d3 100644--- a/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx+++ b/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx@@ -96,7 +96,8 @@ const EditHookPanel = ({ visible, selectedHook, onClose }: EditHookPanelProps) =const restUrlTld = new URL(restUrl as string).hostname.split('.').pop()const isEdgeFunction = (url: string) =>- url.includes(`https://${ref}.functions.supabase.${restUrlTld}/`)+ url.includes(`https://${ref}.functions.supabase.${restUrlTld}/`) ||+ url.includes(`https://${ref}.supabase.${restUrlTld}/functions/`)const initialValues = {name: selectedHook?.name ?? '',@@ -397,7 +398,7 @@ const FormContents = ({}} else if (values.function_type === 'supabase_function') {const fnSlug = (functions ?? [])[0]?.slug- const defaultFunctionUrl = `https://${projectRef}.functions.supabase.${restUrlTld}/${fnSlug}`+ const defaultFunctionUrl = `https://${projectRef}.supabase.${restUrlTld}/functions/v1/${fnSlug}`const updatedValues = {...values,http_url: isEdgeFunction(values.http_url) ? values.http_url : defaultFunctionUrl,diff --git a/studio/components/interfaces/Database/Hooks/HTTPRequestFields.tsx b/studio/components/interfaces/Database/Hooks/HTTPRequestFields.tsxindex 46e0840fa12..05b2ad90b64 100644--- a/studio/components/interfaces/Database/Hooks/HTTPRequestFields.tsx+++ b/studio/components/interfaces/Database/Hooks/HTTPRequestFields.tsx@@ -107,7 +107,7 @@ const HTTPRequestFields = ({{edgeFunctions.map((fn) => {const restUrl = selectedProject?.restUrlconst restUrlTld = new URL(restUrl as string).hostname.split('.').pop()- const functionUrl = `https://${ref}.functions.supabase.${restUrlTld}/${fn.slug}`+ const functionUrl = `https://${ref}.supabase.${restUrlTld}/functions/v1/${fn.slug}`return (<Listbox.Option key={fn.id} id={functionUrl} value={functionUrl} label={fn.name}>diff --git a/studio/components/interfaces/Database/Hooks/HooksList/HookList.tsx b/studio/components/interfaces/Database/Hooks/HooksList/HookList.tsxindex 60705387de0..2edb983e965 100644--- a/studio/components/interfaces/Database/Hooks/HooksList/HookList.tsx+++ b/studio/components/interfaces/Database/Hooks/HooksList/HookList.tsx@@ -52,7 +52,8 @@ const HookList = ({ schema, filterString, editHook = noop, deleteHook = noop }:<>{filteredHooks.map((x: any) => {const isEdgeFunction = (url: string) =>- url.includes(`https://${ref}.functions.supabase.${restUrlTld}/`)+ url.includes(`https://${ref}.functions.supabase.${restUrlTld}/`) ||+ url.includes(`https://${ref}.supabase.${restUrlTld}/functions/`)const [url, method] = x.function_argsreturn (