Skip to content

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

Chore/webhook json (#30797)

Terry Sutton50ede5546f56
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet.tsx b/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet.tsx
index 5d4580608f3..cb541d25750 100644
--- a/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet.tsx
+++ b/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet.tsx
@@ -63,7 +63,19 @@ const edgeFunctionSchema = z.object({
edgeFunctionName: z.string().trim().min(1, 'Please select one of the listed Edge Functions'),
timeoutMs: z.coerce.number().int().gte(1000).lte(5000).default(1000),
httpHeaders: z.array(z.object({ name: z.string(), value: z.string() })),
- httpBody: z.string().trim(),
+ httpBody: z
+ .string()
+ .trim()
+ .optional()
+ .refine((value) => {
+ if (!value) return true
+ try {
+ JSON.parse(value)
+ return true
+ } catch {
+ return false
+ }
+ }, 'Input must be valid JSON'),
})
const httpRequestSchema = z.object({
@@ -77,7 +89,19 @@ const httpRequestSchema = z.object({
.refine((value) => value.startsWith('http'), 'Please include HTTP/HTTPs to your URL'),
timeoutMs: z.coerce.number().int().gte(1000).lte(5000).default(1000),
httpHeaders: z.array(z.object({ name: z.string(), value: z.string() })),
- httpBody: z.string().trim(),
+ httpBody: z
+ .string()
+ .trim()
+ .optional()
+ .refine((value) => {
+ if (!value) return true
+ try {
+ JSON.parse(value)
+ return true
+ } catch {
+ return false
+ }
+ }, 'Input must be valid JSON'),
})
const sqlFunctionSchema = z.object({
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/CronJobCard.tsx b/apps/studio/components/interfaces/Integrations/CronJobs/CronJobCard.tsx
index e1a071142d5..f670e48bc46 100644
--- a/apps/studio/components/interfaces/Integrations/CronJobs/CronJobCard.tsx
+++ b/apps/studio/components/interfaces/Integrations/CronJobs/CronJobCard.tsx
@@ -69,9 +69,7 @@ export const CronJobCard = ({ job, onEditCronJob, onDeleteCronJob }: CronJobCard
onCheckedChange={() => showToggleConfirmationModal(true)}
/>
<Button type="default" icon={<History />}>
- <Link href={`/project/${ref}/integrations/cron/cron-jobs/${job.jobname}`}>
- History
- </Link>
+ <Link href={`/project/${ref}/integrations/cron/jobs/${job.jobname}`}>History</Link>
</Button>
<DropdownMenu>
<DropdownMenuTrigger asChild>
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/CronJobs.utils.ts b/apps/studio/components/interfaces/Integrations/CronJobs/CronJobs.utils.ts
index ba2908fb55c..b62ce3febdb 100644
--- a/apps/studio/components/interfaces/Integrations/CronJobs/CronJobs.utils.ts
+++ b/apps/studio/components/interfaces/Integrations/CronJobs/CronJobs.utils.ts
@@ -9,7 +9,7 @@ export const buildHttpRequestCommand = (
method: 'GET' | 'POST',
url: string,
headers: HTTPHeader[],
- body: string,
+ body: string | undefined,
timeout: number
) => {
return `$$
@@ -20,7 +20,7 @@ export const buildHttpRequestCommand = (
.filter((v) => v.name && v.value)
.map((v) => `'${v.name}', '${v.value}'`)
.join(', ')}),
- ${method === 'POST' ? `body:='${body}',` : ''}
+ ${method === 'POST' && body ? `body:='${body}',` : ''}
timeout_milliseconds:=${timeout}
);
$$`
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/HttpBodyFieldSection.tsx b/apps/studio/components/interfaces/Integrations/CronJobs/HttpBodyFieldSection.tsx
index 82798c330a2..efda8511f72 100644
--- a/apps/studio/components/interfaces/Integrations/CronJobs/HttpBodyFieldSection.tsx
+++ b/apps/studio/components/interfaces/Integrations/CronJobs/HttpBodyFieldSection.tsx
@@ -32,9 +32,6 @@ export const HttpBodyFieldSection = ({ form }: HttpBodyFieldSectionProps) => {
onChange={field.onChange}
/>
</FormControl_Shadcn_>
- <FormDescription_Shadcn_ className="text-foreground-lighter">
- The content should match the content-type header.
- </FormDescription_Shadcn_>
<FormMessage_Shadcn_ />
</FormItem_Shadcn_>
)}
diff --git a/apps/studio/components/layouts/Integrations/tabs.tsx b/apps/studio/components/layouts/Integrations/tabs.tsx
index bc9c475d4a9..dbc25a2c3cf 100644
--- a/apps/studio/components/layouts/Integrations/tabs.tsx
+++ b/apps/studio/components/layouts/Integrations/tabs.tsx
@@ -96,9 +96,7 @@ export const IntegrationTabs = ({ scroll, isSticky }: IntegrationTabsProps) => {
>
<NavMenuItem active={true} className="flex items-center gap-2">
{tab.childIcon}
- <Link href={`/project/${project?.ref}/integrations/${tab.route}`}>
- {childId}
- </Link>
+ <Link href={`${tabUrl}/${childId}`}>{childId}</Link>
</NavMenuItem>
</motion.div>
</>
diff --git a/apps/studio/next.config.js b/apps/studio/next.config.js
index 2deaf3ead2e..6eca251889e 100644
--- a/apps/studio/next.config.js
+++ b/apps/studio/next.config.js
@@ -411,8 +411,8 @@ const nextConfig = {
},
{
permanent: true,
- source: '/project/:ref/.....',
- destination: '/project/:ref/integrations/cron-jobs',
+ source: '/project/:ref/database/cron-jobs',
+ destination: '/project/:ref/integrations/cron',
},
{
permanent: true,