Need solution to error while connecting to remote temporal server from local laptop

Hi,
I am going through Temporal 101 typescript course. I have created worker, workflow definition etc… on my local and I am trying to connect to temporal server which is started on gitpod, temporalio-edu101typesc-o7y0hz5fgon.ws-us92.gitpod.io. The code to create worker is as below.
const nativeConnection = await NativeConnection.connect({
address: ‘temporalio-edu101typesc-o7y0hz5fgon.ws-us92.gitpod.io
});
const worker = await Worker.create({
workflowsPath: require.resolve(‘./workflows’),
activities,
taskQueue: ‘hello-world’,
connection:nativeConnection
});

When I try to start worker
I get error as below
TransportError: tonic::transport::Error(Transport, hyper::Error(Connect, ConnectError(“tcp connect error”, Os { code: 10060, kind: TimedOut, message: “A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.” })))
at Function.connect (C:\Source\temporal-hello-world\node_modules@temporalio\worker\src\connection.ts:51:15)
at async run (C:\Source\temporal-hello-world\src\worker.ts:8:28)

Is it because the server is setup to listen only from within and not from external worker?
Need to understand more on this.
Thanks for the help!!

Hi @SriniDixit,

You can tunnel the TCP port from Gitpod to localhost by using Gitpod Local Companion.

Once Local Companion is running, launch the Gitpod workspace, then navigate to the ports tab and make sure the tunnel icon is present next to port 7233. See:

With this approach, the default localhost:7233 should just work. So there is no need to create NativeConnection.

Note, Local Companion assigns new port if 7233 is it’s occupied locally. The new local port should be displayed on the above tab, e.g. 7233:51234. In that case you do need to create a NativeConnection and assigns address as localhost:51234.

Hi @taonic ,
Thanks for the help! It worked for me.
But I do have a question. In real time scenario where temporal server and worker and client would be on different servers how can we achieve this without using Local companion.
Thanks!

You specify the remote service DNS or IP address through ConnectionOptions.address.