Workflow is not starting another workflow

Hii Team,
I have a requirement where I have an api is which is basically starting a workflow(workflowType = ‘first’). Then that workflow is basically executing and activity. The job of activity is to invoke a workflow(workflowType = ‘second’) written in another service and then signal one of the methods of second workflow type. Workflow id for both the workflows(first and second) are “uniqueId” based on the input of api.
I observed a strange behaviour that for some of the api calls both the workflows were started and workflow was running smoothly but for some of the calls only first workflow was started.

Please help me out here as I have been stuck on this for days.

Why are you starting the second workflow from an activity instead of using a child workflow?

Basically my requirement is that I have workflow(W) running on Microservice A and all “W” does is debiting user’s at a regular interval. The debit method is in microservice B. So inside “W” I need to some how invoke debit method of B without making an explicit api call to B.

You can host workflows in different services and invoke them as child workflows. Just use different task queue names for workflows hosted in different services.

Yes @maxim I did the same but that did not worked. Then I went through the temporal-polygot-snake example and found that gameController service is getting the game info by calling workflow in GameInfo service via one of it’s activities. So I invoked the child workflow using activity and it worked but the think is some times only the parent workflow is starting and workflow is getting stuck for those workflowId’s.

This is screenshot of the UI at that time. for subscriptionWorkflow 3 and 4 debit_user_workflow was not invoked.

Please, provide details what exactly didn’t work. I would recommend looking at the histories of both parent and the child workflows.