{"record":{"id":"7a6ead11b3b77769","repo":"anomalyco/sst","slug":"you-cannot-provide-both-job-and-function-in-th","errorCode":null,"errorMessage":"You cannot provide both \"job\" and \"function\" in the \"${name}\" CronV2 component. The \"job\" property has been deprecated. Use \"function\" instead.","messagePattern":"You cannot provide both \"job\" and \"function\" in the \"(.+?)\" CronV2 component\\. The \"job\" property has been deprecated\\. Use \"function\" instead\\.","errorType":"exception","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/cron-v2.ts","lineNumber":326,"sourceCode":"\n    const parent = this;\n\n    const fnArgs = normalizeFunction();\n    const event = output(args.event || {});\n    normalizeTargets();\n    const enabled = output(args.enabled ?? true);\n    const fn = createFunction();\n    const role = createRole();\n    const schedule = createSchedule();\n\n    this._name = name;\n    this.fn = fn;\n    this._role = role;\n    this._schedule = schedule;\n\n    function normalizeFunction() {\n      if (args.job && args.function)\n        throw new VisibleError(\n          `You cannot provide both \"job\" and \"function\" in the \"${name}\" CronV2 component. The \"job\" property has been deprecated. Use \"function\" instead.`,\n        );\n\n      const input = args.function ?? args.job;\n      return input ? output(input) : undefined;\n    }\n\n    function normalizeTargets() {\n      if (fnArgs && args.task)\n        throw new VisibleError(\n          `You cannot provide both a function and a task in the \"${name}\" CronV2 component.`,\n        );\n      if (!fnArgs && !args.task)\n        throw new VisibleError(\n          `You must provide either a function or a task in the \"${name}\" CronV2 component.`,\n        );\n    }\n","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/cron-v2.ts#L308-L344","documentation":"SST's CronV2 component accepts a scheduled target either via the newer `function` property or the deprecated `job` property. The component throws this VisibleError during argument normalization when both are supplied, because it cannot unambiguously decide which target to schedule. It tells you to migrate to the single `function` property.","triggerScenarios":"Creating `new sst.aws.CronV2(name, {...})` with both `args.function` and `args.job` set (e.g. after partially migrating config from the deprecated `job` API and leaving the old key in place).","commonSituations":"Migrating an sst.config.ts from an older SST version where `job` was the accepted key; copy-pasting an example that uses `job` while an IDE auto-completion added `function`; a stale `job` entry kept alongside a newly added `function`.","solutions":["Remove the deprecated `job` property and keep only `function`","If `job` held an object like { function, ... }, move any nested fields into `function` and delete `job`","Search your sst.config.ts for `job:` in CronV2 args to catch remaining duplicates"],"exampleFix":"// before\nnew sst.aws.CronV2(\"MyCron\", {\n  schedule: \"rate(1 day)\",\n  job: { function: handler },\n  function: handler,\n});\n// after\nnew sst.aws.CronV2(\"MyCron\", {\n  schedule: \"rate(1 day)\",\n  function: handler,\n});","handlingStrategy":"validation","validationCode":"function validateCronV2Args(args: sst.aws.CronV2Args) {\n  if (args.job && args.function)\n    throw new Error(\"Set only one of 'job' (deprecated) or 'function', not both\");\n}","typeGuard":"function hasNoPropConflict<K extends string>(a: Record<string, unknown>, keys: [K, K]): boolean {\n  return !(a[keys[0]] && a[keys[1]]);\n}","tryCatchPattern":"try {\n  new sst.aws.CronV2(\"MyCron\", args);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('both \"job\" and \"function\"')) {\n    console.error(\"Remove the deprecated 'job' property; use 'function' only\");\n  } else throw e;\n}","preventionTips":["Keep only `function` in Cron/CronV2 args; never set the deprecated `job` key","Run `sst dev` after config edits to fail fast on duplicate keys","Grep sst.config.ts for `job:` before upgrading SST"],"tags":["config","validation","deprecated-api","cron"],"backgroundTag":"conflicting-component-props","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}