Cannot connect by Python SDK

Hi all,

I’ve set up the temporal server v1.16.2 and can properly execute workflows via Java SDK or run tctl commands. Somehow python client does not work due to connection problem? Any suggestions on the failure? Thanks!

Using an example from GitHub - temporalio/sdk-python: Temporal Python SDK

Errors are like

File “/home/ubuntu/env/lib/python3.7/site-packages/temporalio/bridge/client.py”, line 74, in connect
await temporalio.bridge.temporal_sdk_bridge.connect_client(config)
RuntimeError: Failed client connect: get_system_info call error after connection: Status { code: Unknown, message: “transport error”, source: Some(tonic::transport::Error(Transport, hyper::Error(Http2, Error { kind: GoAway(b"", FRAME_SIZE_ERROR, Library) })))}

Best,
Jerry

Hello @JerryHu

To try to reproduce the issue, could you point out, which example you are using?

There are more python examples in this repository GitHub - temporalio/samples-python: Samples for working with the Temporal Python SDK, just in case you don’t know about them

Hi @antonio.perez,

Thanks for replying! I use the sample code from python sdk github page. It errors out at this line

client = await Client.connect(“<our_temporal_elb>:7233”)

RuntimeError: Failed client connect: get_system_info call error after connection: Status { code: Unknown, message: “transport error”, source: Some(tonic::transport::Error(Transport, hyper::Error(Http2, Error { kind: GoAway(b"", FRAME_SIZE_ERROR, Library) })))}

Seems it’s related to Http2?

import asyncio
from datetime import datetime, timedelta
from temporalio import workflow, activity
from temporalio.client import Client
from temporalio.worker import Worker

@activity.defn
async def say_hello(name: str) -> str:
    return f"Hello, {name}!"

@workflow.defn
class SayHello:
    @workflow.run
    async def run(self, name: str) -> str:
        return await workflow.execute_activity(
            say_hello, name, schedule_to_close_timeout=timedelta(seconds=5)
        )

async def main():
    # Create client connected to server at the given address
    client = await Client.connect("localhost:7233")

    # Run the worker
    worker = Worker(client, task_queue="my-task-queue", workflows=[SayHello], activities=[say_hello])
    await worker.run()

if __name__ == "__main__":
    asyncio.run(main())

Figured out. Need to set tls=True to connect as we turned on TLS on server side.