The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: cron job has no default for timeout input (#48103)
Gildas Garciad0abc7a64aa2
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet/CreateCronJobSheet.constants.ts b/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet/CreateCronJobSheet.constants.tsindex 45100581cf7..7d5cb4f4d8f 100644--- a/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet/CreateCronJobSheet.constants.ts+++ b/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet/CreateCronJobSheet.constants.ts@@ -38,11 +38,13 @@ const addHttpHeaderIssues = (})}+export const DEFAULT_TIMEOUT = 1000+const edgeFunctionSchema = z.object({type: z.literal('edge_function'),method: z.enum(['GET', 'POST']),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),+ timeoutMs: z.coerce.number().int().gte(1000).lte(5000).default(DEFAULT_TIMEOUT),httpHeaders: httpHeadersSchema,httpBody: z.string()@@ -69,7 +71,7 @@ const httpRequestSchema = z.object({invalidMessage: 'Please provide a valid URL',prefixMessage: 'Please prefix your URL with http:// or https://',}),- timeoutMs: z.coerce.number().int().gte(1000).lte(5000).default(1000),+ timeoutMs: z.coerce.number().int().gte(1000).lte(5000).default(DEFAULT_TIMEOUT),httpHeaders: httpHeadersSchema,httpBody: z.string()diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet/CreateCronJobSheet.tsx b/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet/CreateCronJobSheet.tsxindex 67335691638..8bcc3fc00c1 100644--- a/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet/CreateCronJobSheet.tsx+++ b/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet/CreateCronJobSheet.tsx@@ -40,6 +40,7 @@ import { HttpRequestSection } from '../HttpRequestSection'import { SqlFunctionSection } from '../SqlFunctionSection'import { SqlSnippetSection } from '../SqlSnippetSection'import {+ DEFAULT_TIMEOUT,FormSchema,type CreateCronJobForm,type CronJobType,@@ -268,6 +269,7 @@ export const CreateCronJobSheet = ({ open, selectedCronJob, onClose }: CreateCroendpoint,method,// for some reason, the httpHeaders are not memoized and cause the useEffect to trigger even when the value is the same+ // eslint-disable-next-line react-hooks/exhaustive-depsJSON.stringify(httpHeaders),httpBody,timeoutMs,@@ -334,7 +336,16 @@ export const CreateCronJobSheet = ({ open, selectedCronJob, onClose }: CreateCroname="function_type"value={field.value}disabled={field.disabled}- onValueChange={(value) => field.onChange(value)}+ onValueChange={(value) => {+ field.onChange(value)++ if (value === 'http_request' || value === 'edge_function') {+ form.setValue('values.timeoutMs', DEFAULT_TIMEOUT, {+ shouldDirty: false,+ shouldTouch: false,+ })+ }+ }}>{CRONJOB_DEFINITIONS.map((definition) => (<RadioGroupStackedItem