Issue with Infinite Execution in Temporal Worker Initialization

I’ve integrated Temporal into my existing Node.js microservice, and I’m facing an issue during the initialization of the Temporal worker. It seems that the line await worker.run(); in the temporal.worker.ts file never returns control and executes indefinitely (so the next line streamingRepository.init() never executed). I want to understand if this behavior is expected and how I can resolve it.

Relevant Code Snippets

start.ts

export const start = async (module: NodeModule): Promise<void> => {
  // ... (other code)

  // Temporal worker initialization stuck here
  await temporalWorker.init();

  // Lines below never executed
  streamingRepository.init();
  // ... (other code)
};
start(module);

temporal.worker.ts

// This function sets up and runs the Temporal worker
async function run() {
  // Establish a connection with a Temporal server
  const connection = await NativeConnection.connect({
    address: temporalConstant.TARGET
  });
  logger.debug('Established connection to the Temporal server');

  // Create a Temporal worker configuration
  const worker = await Worker.create({
    workflowsPath: require.resolve('./workflows/report.workflow'),
    activities,
    taskQueue: temporalConstant.TASK_QUEUE,
    namespace: temporalConstant.NAMESPACE,
    connection: connection
  });
  logger.debug('Created a Temporal worker configuration');

  // Start the Temporal worker
  await worker.run();
}

// This function initializes the Temporal worker
const init = async () => {
  logger.info('Initializing a Temporal worker');
  // Run the Temporal worker setup and execution
  await run();
};

// Object encapsulating the Temporal worker functions
const temporalWorker = {
  init
};

export default temporalWorker;

Requested Help

  1. Is the behavior of await worker.run(); running indefinitely expected in the context of Temporal worker initialization?
  2. If not, what could be causing this issue, and how can I resolve/debug it?
  3. Are there any best practices or adjustments I should consider in my Temporal setup to ensure smooth initialization and execution?

Any insights or guidance on this matter would be greatly appreciated. Thank you!