Skip to content

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

Webhooks automatically append authorization header if edge function with verify JWT enabled is selected (#36759)

Joshen Lim88dca021d6b5
diff --git a/apps/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx b/apps/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx
index 73f739cd8f8..f809e700ad6 100644
--- a/apps/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx
+++ b/apps/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx
@@ -1,25 +1,18 @@
-import type { PostgresTable, PostgresTrigger } from '@supabase/postgres-meta'
-import Image from 'next/legacy/image'
-import { MutableRefObject, useEffect, useMemo, useRef, useState } from 'react'
+import { PGTriggerCreate } from '@supabase/pg-meta/src/pg-meta-triggers'
+import type { PostgresTrigger } from '@supabase/postgres-meta'
+import { useEffect, useMemo, useRef, useState } from 'react'
import { toast } from 'sonner'
import { useParams } from 'common'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
-import { FormSection, FormSectionContent, FormSectionLabel } from 'components/ui/Forms/FormSection'
import { useDatabaseTriggerCreateMutation } from 'data/database-triggers/database-trigger-create-mutation'
import { useDatabaseTriggerUpdateMutation } from 'data/database-triggers/database-trigger-update-transaction-mutation'
-import {
- EdgeFunctionsResponse,
- useEdgeFunctionsQuery,
-} from 'data/edge-functions/edge-functions-query'
import { getTableEditor } from 'data/table-editor/table-editor-query'
import { useTablesQuery } from 'data/tables/tables-query'
import { isValidHttpUrl, uuidv4 } from 'lib/helpers'
-import { Button, Checkbox, Form, Input, Listbox, Radio, SidePanel } from 'ui'
+import { Button, Form, SidePanel } from 'ui'
import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'
-import HTTPRequestFields from './HTTPRequestFields'
-import { AVAILABLE_WEBHOOK_TYPES, HOOK_EVENTS } from './Hooks.constants'
-import { PGTriggerCreate } from '@supabase/pg-meta/src/pg-meta-triggers'
+import { FormContents } from './FormContents'
export interface EditHookPanelProps {
visible: boolean
@@ -29,7 +22,19 @@ export interface EditHookPanelProps {
export type HTTPArgument = { id: string; name: string; value: string }
-const EditHookPanel = ({ visible, selectedHook, onClose }: EditHookPanelProps) => {
+export const isEdgeFunction = ({
+ ref,
+ restUrlTld,
+ url,
+}: {
+ ref?: string
+ restUrlTld?: string
+ url: string
+}) =>
+ url.includes(`https://${ref}.functions.supabase.${restUrlTld}/`) ||
+ url.includes(`https://${ref}.supabase.${restUrlTld}/functions/`)
+
+export const EditHookPanel = ({ visible, selectedHook, onClose }: EditHookPanelProps) => {
const { ref } = useParams()
const submitRef = useRef<any>(null)
const [isEdited, setIsEdited] = useState(false)
@@ -49,7 +54,6 @@ const EditHookPanel = ({ visible, selectedHook, onClose }: EditHookPanelProps) =
projectRef: project?.ref,
connectionString: project?.connectionString,
})
- const { data: functions } = useEdgeFunctionsQuery({ projectRef: ref })
const [isSubmitting, setIsSubmitting] = useState(false)
const { mutate: createDatabaseTrigger } = useDatabaseTriggerCreateMutation({
onSuccess: (res) => {
@@ -81,16 +85,12 @@ const EditHookPanel = ({ visible, selectedHook, onClose }: EditHookPanelProps) =
const restUrl = project?.restUrl
const restUrlTld = restUrl ? new URL(restUrl).hostname.split('.').pop() : 'co'
- const isEdgeFunction = (url: string) =>
- url.includes(`https://${ref}.functions.supabase.${restUrlTld}/`) ||
- url.includes(`https://${ref}.supabase.${restUrlTld}/functions/`)
-
const initialValues = {
name: selectedHook?.name ?? '',
table_id: selectedHook?.table_id ?? '',
http_url: selectedHook?.function_args?.[0] ?? '',
http_method: selectedHook?.function_args?.[1] ?? 'POST',
- function_type: isEdgeFunction(selectedHook?.function_args?.[0] ?? '')
+ function_type: isEdgeFunction({ ref, restUrlTld, url: selectedHook?.function_args?.[0] ?? '' })
? 'supabase_function'
: 'http_request',
timeout_ms: Number(selectedHook?.function_args?.[4] ?? 5000),
@@ -104,7 +104,7 @@ const EditHookPanel = ({ visible, selectedHook, onClose }: EditHookPanelProps) =
if (selectedHook !== undefined) {
setEvents(selectedHook.events)
- const [url, method, headers, parameters] = selectedHook.function_args
+ const [_, __, headers, parameters] = selectedHook.function_args
let parsedParameters: Record<string, string> = {}
@@ -314,10 +314,6 @@ const EditHookPanel = ({ visible, selectedHook, onClose }: EditHookPanelProps) =
values={values}
resetForm={resetForm}
errors={errors}
- projectRef={ref}
- restUrlTld={restUrlTld}
- functions={functions}
- isEdgeFunction={isEdgeFunction}
tables={tables}
events={events}
eventsError={eventsError}
@@ -352,211 +348,3 @@ const EditHookPanel = ({ visible, selectedHook, onClose }: EditHookPanelProps) =
</>
)
}
-
-export default EditHookPanel
-
-interface FormContentsProps {
- values: any
- resetForm: any
- errors: any
- projectRef?: string
- restUrlTld?: string
- selectedHook?: PostgresTrigger
- functions: EdgeFunctionsResponse[] | undefined
- isEdgeFunction: (url: string) => boolean
- tables: PostgresTable[]
- events: string[]
- eventsError?: string
- onUpdateSelectedEvents: (event: string) => void
- httpHeaders: HTTPArgument[]
- httpParameters: HTTPArgument[]
- setHttpHeaders: (arr: HTTPArgument[]) => void
- setHttpParameters: (arr: HTTPArgument[]) => void
- submitRef: MutableRefObject<any>
-}
-
-const FormContents = ({
- values,
- resetForm,
- errors,
- projectRef,
- restUrlTld,
- selectedHook,
- functions,
- isEdgeFunction,
- tables,
- events,
- eventsError,
- onUpdateSelectedEvents,
- httpHeaders,
- httpParameters,
- setHttpHeaders,
- setHttpParameters,
- submitRef,
-}: FormContentsProps) => {
- useEffect(() => {
- if (values.function_type === 'http_request') {
- if (selectedHook !== undefined) {
- const [url, method] = selectedHook.function_args
- const updatedValues = { ...values, http_url: url, http_method: method }
- resetForm({ values: updatedValues, initialValues: updatedValues })
- } else {
- const updatedValues = { ...values, http_url: '' }
- resetForm({ values: updatedValues, initialValues: updatedValues })
- }
- } else if (values.function_type === 'supabase_function') {
- const fnSlug = (functions ?? [])[0]?.slug
- const defaultFunctionUrl = `https://${projectRef}.supabase.${restUrlTld}/functions/v1/${fnSlug}`
- const updatedValues = {
- ...values,
- http_url: isEdgeFunction(values.http_url) ? values.http_url : defaultFunctionUrl,
- }
- resetForm({ values: updatedValues, initialValues: updatedValues })
- }
- }, [values.function_type])
-
- return (
- <div>
- <FormSection header={<FormSectionLabel className="lg:!col-span-4">General</FormSectionLabel>}>
- <FormSectionContent loading={false} className="lg:!col-span-8">
- <Input
- id="name"
- name="name"
- label="Name"
- descriptionText="Do not use spaces/whitespaces"
- />
- </FormSectionContent>
- </FormSection>
- <SidePanel.Separator />
- <FormSection
- header={
- <FormSectionLabel
- className="lg:!col-span-4"
- description={
- <p className="text-sm text-foreground-light">
- Select which table and events will trigger your webhook
- </p>
- }
- >
- Conditions to fire webhook
- </FormSectionLabel>
- }
- >
- <FormSectionContent loading={false} className="lg:!col-span-8">
- <Listbox
- size="medium"
- id="table_id"
- name="table_id"
- label="Table"
- descriptionText="This is the table the trigger will watch for changes. You can only select 1 table for a trigger."
- >
- <Listbox.Option
- key={'table-no-selection'}
- id={'table-no-selection'}
- label={'---'}
- value={'no-selection'}
- >
- ---
- </Listbox.Option>
- {tables.map((table) => (
- <Listbox.Option
- key={table.id}
- id={table.id.toString()}
- value={table.id}
- label={table.name}
- >
- <div className="flex items-center space-x-2">
- <p className="text-foreground-light">{table.schema}</p>
- <p className="text-foreground">{table.name}</p>
- </div>
- </Listbox.Option>
- ))}
- </Listbox>
- <Checkbox.Group
- id="events"
- name="events"
- label="Events"
- error={eventsError}
- descriptionText="These are the events that are watched by the webhook, only the events selected above will fire the webhook on the table you've selected."
- >
- {HOOK_EVENTS.map((event) => (
- <Checkbox
- key={event.value}
- value={event.value}
- label={event.label}
- description={event.description}
- checked={events.includes(event.value)}
- onChange={() => onUpdateSelectedEvents(event.value)}
- />
- ))}
- </Checkbox.Group>
- </FormSectionContent>
- </FormSection>
- <SidePanel.Separator />
- <FormSection
- header={
- <FormSectionLabel className="lg:!col-span-4">Webhook configuration</FormSectionLabel>
- }
- >
- <FormSectionContent loading={false} className="lg:!col-span-8">
- <Radio.Group id="function_type" name="function_type" label="Type of webhook" type="cards">
- {AVAILABLE_WEBHOOK_TYPES.map((webhook) => (
- <Radio
- key={webhook.value}
- id={webhook.value}
- value={webhook.value}
- label=""
- beforeLabel={
- <div className="flex items-center space-x-5">
- <Image src={webhook.icon} layout="fixed" width="32" height="32" />
- <div className="flex-col space-y-0">
- <div className="flex space-x-2">
- <p className="text-foreground">{webhook.label}</p>
- </div>
- <p className="text-foreground-light">{webhook.description}</p>
- </div>
- </div>
- }
- />
- ))}
- </Radio.Group>
- </FormSectionContent>
- </FormSection>
- <SidePanel.Separator />
-
- <HTTPRequestFields
- type={values.function_type}
- errors={errors}
- httpHeaders={httpHeaders}
- httpParameters={httpParameters}
- onAddHeader={(header?: any) => {
- if (header) setHttpHeaders(httpHeaders.concat(header))
- else setHttpHeaders(httpHeaders.concat({ id: uuidv4(), name: '', value: '' }))
- }}
- onUpdateHeader={(idx, property, value) =>
- setHttpHeaders(
- httpHeaders.map((header, i) => {
- if (idx === i) return { ...header, [property]: value }
- else return header
- })
- )
- }
- onRemoveHeader={(idx) => setHttpHeaders(httpHeaders.filter((_, i) => idx !== i))}
- onAddParameter={() =>
- setHttpParameters(httpParameters.concat({ id: uuidv4(), name: '', value: '' }))
- }
- onUpdateParameter={(idx, property, value) =>
- setHttpParameters(
- httpParameters.map((param, i) => {
- if (idx === i) return { ...param, [property]: value }
- else return param
- })
- )
- }
- onRemoveParameter={(idx) => setHttpParameters(httpParameters.filter((_, i) => idx !== i))}
- />
-
- <button ref={submitRef} type="submit" className="hidden" />
- </div>
- )
-}
diff --git a/apps/studio/components/interfaces/Database/Hooks/FormContents.tsx b/apps/studio/components/interfaces/Database/Hooks/FormContents.tsx
new file mode 100644
index 00000000000..8841de7b993
--- /dev/null
+++ b/apps/studio/components/interfaces/Database/Hooks/FormContents.tsx
@@ -0,0 +1,260 @@
+import type { PostgresTable, PostgresTrigger } from '@supabase/postgres-meta'
+import Image from 'next/legacy/image'
+import { MutableRefObject, useEffect } from 'react'
+
+import { useParams } from 'common'
+import { FormSection, FormSectionContent, FormSectionLabel } from 'components/ui/Forms/FormSection'
+import { useAPIKeysQuery } from 'data/api-keys/api-keys-query'
+import { useEdgeFunctionsQuery } from 'data/edge-functions/edge-functions-query'
+import { useSelectedProject } from 'hooks/misc/useSelectedProject'
+import { uuidv4 } from 'lib/helpers'
+import { Checkbox, Input, Listbox, Radio, SidePanel } from 'ui'
+import { HTTPArgument, isEdgeFunction } from './EditHookPanel'
+import HTTPRequestFields from './HTTPRequestFields'
+import { AVAILABLE_WEBHOOK_TYPES, HOOK_EVENTS } from './Hooks.constants'
+
+export interface FormContentsProps {
+ values: any
+ resetForm: any
+ errors: any
+ selectedHook?: PostgresTrigger
+ tables: PostgresTable[]
+ events: string[]
+ eventsError?: string
+ onUpdateSelectedEvents: (event: string) => void
+ httpHeaders: HTTPArgument[]
+ httpParameters: HTTPArgument[]
+ setHttpHeaders: (arr: HTTPArgument[]) => void
+ setHttpParameters: (arr: HTTPArgument[]) => void
+ submitRef: MutableRefObject<any>
+}
+
+export const FormContents = ({
+ values,
+ resetForm,
+ errors,
+ selectedHook,
+ tables,
+ events,
+ eventsError,
+ onUpdateSelectedEvents,
+ httpHeaders,
+ httpParameters,
+ setHttpHeaders,
+ setHttpParameters,
+ submitRef,
+}: FormContentsProps) => {
+ const { ref } = useParams()
+ const project = useSelectedProject()
+
+ const restUrl = project?.restUrl
+ const restUrlTld = restUrl ? new URL(restUrl).hostname.split('.').pop() : 'co'
+
+ const { data: keys = [] } = useAPIKeysQuery({ projectRef: ref, reveal: true })
+ const { data: functions = [] } = useEdgeFunctionsQuery({ projectRef: ref })
+
+ const legacyServiceRole = keys.find((x) => x.name === 'service_role')?.api_key ?? '[YOUR API KEY]'
+
+ useEffect(() => {
+ if (values.function_type === 'http_request') {
+ if (selectedHook !== undefined) {
+ const [url, method] = selectedHook.function_args
+ const updatedValues = { ...values, http_url: url, http_method: method }
+ resetForm({ values: updatedValues, initialValues: updatedValues })
+ } else {
+ const updatedValues = { ...values, http_url: '' }
+ resetForm({ values: updatedValues, initialValues: updatedValues })
+ }
+ } else if (values.function_type === 'supabase_function') {
+ // Default to first edge function in the list
+ const fnSlug = functions[0]?.slug
+ const defaultFunctionUrl = `https://${ref}.supabase.${restUrlTld}/functions/v1/${fnSlug}`
+ const updatedValues = {
+ ...values,
+ http_url: isEdgeFunction({ ref, restUrlTld, url: values.http_url })
+ ? values.http_url
+ : defaultFunctionUrl,
+ }
+ resetForm({ values: updatedValues, initialValues: updatedValues })
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [values.function_type])
+
+ useEffect(() => {
+ const isEdgeFunctionSelected = isEdgeFunction({ ref, restUrlTld, url: values.http_url })
+
+ if (values.http_url && isEdgeFunctionSelected) {
+ const fnSlug = values.http_url.split('/').at(-1)
+ const fn = functions.find((x) => x.slug === fnSlug)
+
+ if (fn?.verify_jwt) {
+ if (!httpHeaders.some((x) => x.name === 'Authorization')) {
+ const authorizationHeader = {
+ id: uuidv4(),
+ name: 'Authorization',
+ value: `Bearer ${legacyServiceRole}`,
+ }
+ setHttpHeaders([...httpHeaders, authorizationHeader])
+ }
+ } else {
+ const updatedHttpHeaders = httpHeaders.filter((x) => x.name !== 'Authorization')
+ setHttpHeaders(updatedHttpHeaders)
+ }
+ } else {
+ const updatedHttpHeaders = httpHeaders.filter((x) => x.name !== 'Authorization')
+ setHttpHeaders(updatedHttpHeaders)
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [values.http_url])
+
+ return (
+ <div>
+ <FormSection header={<FormSectionLabel className="lg:!col-span-4">General</FormSectionLabel>}>
+ <FormSectionContent loading={false} className="lg:!col-span-8">
+ <Input
+ id="name"
+ name="name"
+ label="Name"
+ descriptionText="Do not use spaces/whitespaces"
+ />
+ </FormSectionContent>
+ </FormSection>
+ <SidePanel.Separator />
+ <FormSection
+ header={
+ <FormSectionLabel
+ className="lg:!col-span-4"
+ description={
+ <p className="text-sm text-foreground-light">
+ Select which table and events will trigger your webhook
+ </p>
+ }
+ >
+ Conditions to fire webhook
+ </FormSectionLabel>
+ }
+ >
+ <FormSectionContent loading={false} className="lg:!col-span-8">
+ <Listbox
+ size="medium"
+ id="table_id"
+ name="table_id"
+ label="Table"
+ descriptionText="This is the table the trigger will watch for changes. You can only select 1 table for a trigger."
+ >
+ <Listbox.Option
+ key={'table-no-selection'}
+ id={'table-no-selection'}
+ label={'---'}
+ value={'no-selection'}
+ >
+ ---
+ </Listbox.Option>
+ {tables.map((table) => (
+ <Listbox.Option
+ key={table.id}
+ id={table.id.toString()}
+ value={table.id}
+ label={table.name}
+ >
+ <div className="flex items-center space-x-2">
+ <p className="text-foreground-light">{table.schema}</p>
+ <p className="text-foreground">{table.name}</p>
+ </div>
+ </Listbox.Option>
+ ))}
+ </Listbox>
+ <Checkbox.Group
+ id="events"
+ name="events"
+ label="Events"
+ error={eventsError}
+ descriptionText="These are the events that are watched by the webhook, only the events selected above will fire the webhook on the table you've selected."
+ >
+ {HOOK_EVENTS.map((event) => (
+ <Checkbox
+ key={event.value}
+ value={event.value}
+ label={event.label}
+ description={event.description}
+ checked={events.includes(event.value)}
+ onChange={() => onUpdateSelectedEvents(event.value)}
+ />
+ ))}
+ </Checkbox.Group>
+ </FormSectionContent>
+ </FormSection>
+ <SidePanel.Separator />
+ <FormSection
+ header={
+ <FormSectionLabel className="lg:!col-span-4">Webhook configuration</FormSectionLabel>
+ }
+ >
+ <FormSectionContent loading={false} className="lg:!col-span-8">
+ <Radio.Group id="function_type" name="function_type" label="Type of webhook" type="cards">
+ {AVAILABLE_WEBHOOK_TYPES.map((webhook) => (
+ <Radio
+ key={webhook.value}
+ id={webhook.value}
+ value={webhook.value}
+ label=""
+ beforeLabel={
+ <div className="flex items-center space-x-5">
+ <Image
+ alt={webhook.label}
+ src={webhook.icon}
+ layout="fixed"
+ width="32"
+ height="32"
+ />
+ <div className="flex-col space-y-0">
+ <div className="flex space-x-2">
+ <p className="text-foreground">{webhook.label}</p>
+ </div>
+ <p className="text-foreground-light">{webhook.description}</p>
+ </div>
+ </div>
+ }
+ />
+ ))}
+ </Radio.Group>
+ </FormSectionContent>
+ </FormSection>
+ <SidePanel.Separator />
+
+ <HTTPRequestFields
+ type={values.function_type}
+ errors={errors}
+ httpHeaders={httpHeaders}
+ httpParameters={httpParameters}
+ onAddHeader={(header?: any) => {
+ if (header) setHttpHeaders(httpHeaders.concat(header))
+ else setHttpHeaders(httpHeaders.concat({ id: uuidv4(), name: '', value: '' }))
+ }}
+ onUpdateHeader={(idx, property, value) =>
+ setHttpHeaders(
+ httpHeaders.map((header, i) => {
+ if (idx === i) return { ...header, [property]: value }
+ else return header
+ })
+ )
+ }
+ onRemoveHeader={(idx) => setHttpHeaders(httpHeaders.filter((_, i) => idx !== i))}
+ onAddParameter={() =>
+ setHttpParameters(httpParameters.concat({ id: uuidv4(), name: '', value: '' }))
+ }
+ onUpdateParameter={(idx, property, value) =>
+ setHttpParameters(
+ httpParameters.map((param, i) => {
+ if (idx === i) return { ...param, [property]: value }
+ else return param
+ })
+ )
+ }
+ onRemoveParameter={(idx) => setHttpParameters(httpParameters.filter((_, i) => idx !== i))}
+ />
+
+ <button ref={submitRef} type="submit" className="hidden" />
+ </div>
+ )
+}
diff --git a/apps/studio/components/interfaces/Database/Hooks/HTTPRequestFields.tsx b/apps/studio/components/interfaces/Database/Hooks/HTTPRequestFields.tsx
index 78081397bea..e77c36658d2 100644
--- a/apps/studio/components/interfaces/Database/Hooks/HTTPRequestFields.tsx
+++ b/apps/studio/components/interfaces/Database/Hooks/HTTPRequestFields.tsx
@@ -1,8 +1,9 @@
-import { ChevronDown, Plus, Trash } from 'lucide-react'
+import { ChevronDown, Plus, X } from 'lucide-react'
import Link from 'next/link'
import { useParams } from 'common'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
+import { ButtonTooltip } from 'components/ui/ButtonTooltip'
import { FormSection, FormSectionContent, FormSectionLabel } from 'components/ui/Forms/FormSection'
import { getAPIKeys, useProjectSettingsV2Query } from 'data/config/project-settings-v2-query'
import { useEdgeFunctionsQuery } from 'data/edge-functions/edge-functions-query'
@@ -143,12 +144,12 @@ const HTTPRequestFields = ({
placeholder="Header value"
onChange={(event: any) => onUpdateHeader(idx, 'value', event.target.value)}
/>
- <Button
- type="default"
- size="medium"
- icon={<Trash size="14" />}
- className="px-[10px] py-[9px]"
+ <ButtonTooltip
+ type="text"
+ icon={<X />}
+ className="py-4"
onClick={() => onRemoveHeader(idx)}
+ tooltip={{ content: { side: 'bottom', text: 'Remove header' } }}
/>
</div>
))}
@@ -234,12 +235,12 @@ const HTTPRequestFields = ({
placeholder="Parameter value"
onChange={(event: any) => onUpdateParameter(idx, 'value', event.target.value)}
/>
- <Button
- type="default"
- size="medium"
- icon={<Trash size="14" />}
- className="px-[10px] py-[9px]"
+ <ButtonTooltip
+ type="text"
+ className="py-4"
+ icon={<X />}
onClick={() => onRemoveParameter(idx)}
+ tooltip={{ content: { side: 'bottom', text: 'Remove parameter' } }}
/>
</div>
))}
diff --git a/apps/studio/components/interfaces/Database/Hooks/HooksList/HooksList.tsx b/apps/studio/components/interfaces/Database/Hooks/HooksList/HooksList.tsx
index 81b7d0b2dd2..ea3bd83c61a 100644
--- a/apps/studio/components/interfaces/Database/Hooks/HooksList/HooksList.tsx
+++ b/apps/studio/components/interfaces/Database/Hooks/HooksList/HooksList.tsx
@@ -1,20 +1,20 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { includes, map as lodashMap, uniqBy } from 'lodash'
-import { BookOpen, Search } from 'lucide-react'
+import { Search } from 'lucide-react'
import { useState } from 'react'
-import { Button, Input } from 'ui'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
import AlertError from 'components/ui/AlertError'
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
+import { DocsButton } from 'components/ui/DocsButton'
import NoSearchResults from 'components/ui/NoSearchResults'
import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
import { useDatabaseHooksQuery } from 'data/database-triggers/database-triggers-query'
import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions'
import { noop } from 'lib/void'
+import { Input } from 'ui'
import HooksListEmpty from './HooksListEmpty'
import SchemaTable from './SchemaTable'
-import { DocsButton } from 'components/ui/DocsButton'
export interface HooksListProps {
createHook: () => void
diff --git a/apps/studio/components/interfaces/Integrations/Webhooks/ListTab.tsx b/apps/studio/components/interfaces/Integrations/Webhooks/ListTab.tsx
index 4afe8207280..adc735b52e5 100644
--- a/apps/studio/components/interfaces/Integrations/Webhooks/ListTab.tsx
+++ b/apps/studio/components/interfaces/Integrations/Webhooks/ListTab.tsx
@@ -2,7 +2,7 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useState } from 'react'
import DeleteHookModal from 'components/interfaces/Database/Hooks/DeleteHookModal'
-import EditHookPanel from 'components/interfaces/Database/Hooks/EditHookPanel'
+import { EditHookPanel } from 'components/interfaces/Database/Hooks/EditHookPanel'
import HooksList from 'components/interfaces/Database/Hooks/HooksList/HooksList'
import NoPermission from 'components/ui/NoPermission'
import { useCheckPermissions, usePermissionsLoaded } from 'hooks/misc/useCheckPermissions'
@@ -13,7 +13,6 @@ export const WebhooksListTab = () => {
const [showDeleteHookForm, setShowDeleteHookForm] = useState<boolean>(false)
const canReadWebhooks = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_READ, 'triggers')
- const canCreateWebhooks = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, 'triggers')
const isPermissionsLoaded = usePermissionsLoaded()
const createHook = () => {