How to invoke worker from the client from within the context of an HTTP API call?

Whenever I try to start or execute a workflow from within the context of my HTTP API, the workflow remains in the Running state and does not complete until I manually terminate it.

The same code to execute the workflow runs to completion when I run the client directly i.e node client.js

Is there something I need to do differently to make it work within the context of the HTTP API?

I have tried with both .execute and .start with the former blocking the HTTP response and the later returning the HTTP response.

const result = await client.execute(example, {
        args: ['Temporal'],
        taskQueue: 'hello-javascript1', //'tutorial',
        // in practice, use a meaningful business id, eg customerId or transactionId
        workflowId: 'wf-id-' + Math.floor(Math.random() * 1000),
      });
const handle = await client.start(example, {
        args: ['Temporal'],
        taskQueue: 'hello-javascript2',
        // in practice, use a meaningful business id, eg customerId or transactionId
        workflowId: 'wf-id-' + Math.floor(Math.random() * 1000),
      });

My guess is the worker and client.js task queue match, but the HTTP API task queue is different?

If the workflow type, args, and task queue are all the same, the workflow should run the same

1 Like