ServiceError: Failed to start Workflow

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)

Use docker-compose to install Temporal on a Mac M2 computer.

Are you able to run the samples? Can you connect to the cluster using CLI?

Yes, the “Hello World” program has been successfully run.

➜  hello-world npm run workflow

> temporal-hello-world@0.1.0 workflow
> ts-node src/client.ts

Started workflow workflow-2LDabOySZas_5UkAu6uXK
Hello, Temporal!

Have you compared how “Hello World” client initialization differs from your program?