Trying to use streamlit behing AWS API Gateway but always get error

Hi I am trying to run streamlit on ECS using an API Gateway to protect access. Since it is required that connection should be private. Socket route from API gateway towards streamlit uses uri: wss://somesocket.execute-api.us-east-1.amazonaws.com/prod
which is different from the https uri.

I am launching streamlit using the following command:

streamlit run chat_streamlit.py --logger.level debug --server.port 8002 --server.address wss://somesocket.execute-api.us-east-1.amazonaws.com  --server.baseUrlPath=/prod  --browser.serverAddress 0.0.0.0 --server.enableCORS=false --server.enableXsrfProtection=false

However the application does not launch with the following stack trace:

1688062460671,"  File ""/usr/local/lib/python3.11/site-packages/streamlit/web/bootstrap.py"", line 418, in run_server"
1688062460671,    await server.start()
1688062460671,"  File ""/usr/local/lib/python3.11/site-packages/streamlit/web/server/server.py"", line 258, in start"
1688062460671,    start_listening(app)
1688062460671,"  File ""/usr/local/lib/python3.11/site-packages/streamlit/web/server/server.py"", line 129, in start_listening"
1688062460671,    start_listening_tcp_socket(http_server)
1688062460671,"  File ""/usr/local/lib/python3.11/site-packages/streamlit/web/server/server.py"", line 188, in start_listening_tcp_socket"
1688062460671,"    http_server.listen(port, address)"
1688062460671,"  File ""/usr/local/lib/python3.11/site-packages/tornado/tcpserver.py"", line 183, in listen"
1688062460671,    sockets = bind_sockets(
1688062460671,              ^^^^^^^^^^^^^
1688062460671,"  File ""/usr/local/lib/python3.11/site-packages/tornado/netutil.py"", line 105, in bind_sockets"
1688062460671,"    socket.getaddrinfo(address, port, family, socket.SOCK_STREAM, 0, flags),"
1688062460671,    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1688062460671,"  File ""/usr/local/lib/python3.11/socket.py"", line 962, in getaddrinfo"
1688062460671,"    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):"
1688062460671,               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1688062460671,socket.gaierror: [Errno -2] Name or service not known

Looks like it is not finding the socket. However, I am confused if am using parameters correclty.

Any help appreciated.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.