Using TypeScript, an error occurs when calling Temporal execute for scheduled tasks.
async startCronWorkflow(id: string, queue: string, workflow: string, args: Array<any>, duration: string):Promise<Boolean> {
console.log(id, queue, workflow, args, duration)
const handle = await this.client.workflow.execute(workflow, {
taskQueue: queue, args: args, workflowId: id, cronSchedule: `every ${duration}`});
return true;
}
error message
ServiceError: Failed to start Workflow
at WorkflowClient.rethrowGrpcError (xxx/node_modules/@temporalio/client/src/workflow-client.ts:592:13)
at WorkflowClient._startWorkflowHandler (xxx/node_modules/@temporalio/client/src/workflow-client.ts:742:12)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at WorkflowClient.execute (xxx/node_modules/@temporalio/client/src/workflow-client.ts:456:5)
at TemporalService.startCronWorkflow (xxx/src/temporal/temporal.service.ts:34:24)
at CronjobService.start (xxx/src/cronjob/cronjob.service.ts:16:21)