{"record":{"id":"9199e50c23e26c87","repo":"anomalyco/sst","slug":"you-cannot-provide-both-job-and-worker-in-the","errorCode":null,"errorMessage":"You cannot provide both \"job\" and \"worker\" in the \"${name}\" Cron component. The \"job\" property has been deprecated. Use \"worker\" instead.","messagePattern":"You cannot provide both \"job\" and \"worker\" in the \"(.+?)\" Cron component\\. The \"job\" property has been deprecated\\. Use \"worker\" instead\\.","errorType":"validation","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/cloudflare/cron.ts","lineNumber":156,"sourceCode":" */\nexport class Cron extends Component {\n  private worker: WorkerBuilder;\n  private trigger: Output<cf.WorkerCronTrigger>;\n\n  constructor(name: string, args: CronArgs, opts?: ComponentResourceOptions) {\n    super(__pulumiType, name, args, opts);\n\n    const parent = this;\n\n    const workerArgs = normalizeWorker();\n    const worker = createWorker();\n    const trigger = createTrigger();\n    this.worker = worker;\n    this.trigger = trigger;\n\n    function normalizeWorker() {\n      if (args.job && args.worker)\n        throw new VisibleError(\n          `You cannot provide both \"job\" and \"worker\" in the \"${name}\" Cron component. The \"job\" property has been deprecated. Use \"worker\" instead.`,\n        );\n      return args.worker ?? args.job;\n    }\n\n    function createWorker() {\n      if (!workerArgs)\n        throw new VisibleError(\n          `You must provide a \"worker\" for the \"${name}\" Cron component.`,\n        );\n      return workerBuilder(`${name}Handler`, workerArgs, undefined, undefined, args.accountId);\n    }\n\n    function createTrigger() {\n      return all([args.schedules]).apply(([schedules]) => {\n        return new cloudflare.WorkersCronTrigger(\n          ...transform(\n            args.transform?.trigger,","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/cloudflare/cron.ts#L138-L174","documentation":"The Cloudflare Cron component's `job` property is deprecated in favor of `worker`. Providing both makes the intent ambiguous, so SST throws immediately during argument normalization instead of guessing.","triggerScenarios":"Defining a `sst.cloudflare.Cron` with both `job: {...}` and `worker: {...}` set in the same component args; normalizeWorker() detects both and throws at synth time.","commonSituations":"Migrating an existing Cron from `job` to `worker` and adding the new key before removing the old one; copy-pasting example configs that mix old and new API.","solutions":["Remove the deprecated `job` property and keep only `worker`.","If you intended the old behavior only, remove `worker` and keep `job` (deprecated, so migrate eventually)."],"exampleFix":"// before\nnew sst.cloudflare.Cron(app, \"Cron\", {\n  job: { scriptPath: \"./src/job.ts\" },\n  worker: { scriptPath: \"./src/worker.ts\" },\n});\n// after\nnew sst.cloudflare.Cron(app, \"Cron\", {\n  worker: { scriptPath: \"./src/worker.ts\" },\n});","handlingStrategy":"validation","validationCode":"const cronArgs = { job: undefined, worker: { handler: \"./src/worker.ts\" } };\nif (cronArgs.job && cronArgs.worker) throw new Error(\"Provide only 'worker' ('job' is deprecated)\");","typeGuard":"const usesOnlyWorker = (a: { job?: unknown; worker?: unknown }) =>\n  a.worker != null && a.job == null;","tryCatchPattern":"try {\n  new sst.cloudflare.Cron(app, \"Cron\", cronArgs);\n} catch (e) {\n  if (String(e).includes('both \"job\" and \"worker\"')) console.error(\"Remove deprecated 'job' property\");\n  else throw e;\n}","preventionTips":["Always use `worker` in new Cron components.","Search your config for `job:` on Cron components after SST upgrades.","Never copy old `job`-based examples alongside new `worker` config."],"tags":["cloudflare","cron","deprecated-api","conflicting-options","sst-config"],"backgroundTag":"conflicting-component-options","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}