Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker container doesn't start conversation #262

Closed
Van0SS opened this issue Jun 30, 2023 · 7 comments
Closed

Docker container doesn't start conversation #262

Van0SS opened this issue Jun 30, 2023 · 7 comments

Comments

@Van0SS
Copy link
Contributor

Van0SS commented Jun 30, 2023

Repro:

Build image:

docker build -t vocode-client-backend .

Setup .env:

DEEPGRAM_API_KEY=(YOUR KEY)
OPENAI_API_KEY=(YOUR KEY)
AZURE_SPEECH_KEY=(YOUR KEY)
AZURE_SPEECH_REGION=(YOUR REGION)

Run backend:

docker run --env-file=.env -p 3000:3000 -t vocode-client-backend

Run frontend vocode-react-demo. Use custom backendUrl: "wss:https://localhost:3000/conversation"
When it tries to connect, runtime Issue happens at the backend:

Runtime error: Failed to initialize platform (azure-c-shared). Error: 2153
ERROR:    closing handshake failed

Thoughts

Most likely it's related to that Azure issue
TLDR: Ubuntu 22.04 moved to OpenSSL version 3. The Cognitive Services Speech SDK has not been updated to support OpenSSL 3 and instead is still using OpenSSL 1.1.1. The issue still is not resolved.

In vocode case, it's Debian 12 and OpenSSL 3.0.9.

Resolution could be to manually downgrade openssl to 1.1.1. I didn't try to do it yet and not sure about side effects, also I don't think it's great idea since OpenSSL 1.1.1 won't be supported after 11th September 2023.

More info:

Inside vocode Docker container:

# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
# openssl version
OpenSSL 3.0.9 30 May 2023 (Library: OpenSSL 3.0.9 30 May 2023)

Full error log:

DEBUG:main:Conversation started
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 254, in run_asgi
    result = await self.app(self.scope, self.asgi_receive, self.asgi_send)
  File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/fastapi/applications.py", line 276, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 149, in __call__
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/usr/local/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "/usr/local/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 341, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 82, in app
    await func(session)
  File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 289, in app
    await dependant.call(**values)
  File "/usr/local/lib/python3.9/site-packages/vocode/streaming/client_backend/conversation.py", line 93, in conversation
    conversation = self.get_conversation(output_device, start_message)
  File "/usr/local/lib/python3.9/site-packages/vocode/streaming/client_backend/conversation.py", line 70, in get_conversation
    synthesizer = self.synthesizer_thunk(start_message.output_audio_config)
  File "/code/main.py", line 29, in <lambda>
    synthesizer_thunk=lambda output_audio_config: AzureSynthesizer(
  File "/usr/local/lib/python3.9/site-packages/vocode/streaming/synthesizer/azure_synthesizer.py", line 106, in __init__
    self.synthesizer = speechsdk.SpeechSynthesizer(
  File "/usr/local/lib/python3.9/site-packages/azure/cognitiveservices/speech/speech.py", line 2149, in __init__
    _call_hr_fn(fn=_sdk_lib.synthesizer_create_speech_synthesizer_from_config, *[
  File "/usr/local/lib/python3.9/site-packages/azure/cognitiveservices/speech/interop.py", line 62, in _call_hr_fn
    _raise_if_failed(hr)
  File "/usr/local/lib/python3.9/site-packages/azure/cognitiveservices/speech/interop.py", line 55, in _raise_if_failed
    __try_get_error(_spx_handle(hr))
  File "/usr/local/lib/python3.9/site-packages/azure/cognitiveservices/speech/interop.py", line 50, in __try_get_error
    raise RuntimeError(message)
RuntimeError: Exception with error code: 
[CALL STACK BEGIN]

/usr/local/lib/python3.9/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1d2181) [0x7f0d84fd2181]
/usr/local/lib/python3.9/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1ef2c1) [0x7f0d84fef2c1]
/lib/x86_64-linux-gnu/libc.so.6(+0x8de37) [0x7f0d90a9ae37]
/usr/local/lib/python3.9/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1f034e) [0x7f0d84ff034e]
/usr/local/lib/python3.9/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1a6d3b) [0x7f0d84fa6d3b]
/usr/local/lib/python3.9/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1a65e7) [0x7f0d84fa65e7]
/usr/local/lib/python3.9/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1d9654) [0x7f0d84fd9654]
/usr/local/lib/python3.9/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1b3d6a) [0x7f0d84fb3d6a]
/usr/local/lib/python3.9/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1c47fa) [0x7f0d84fc47fa]
/usr/local/lib/python3.9/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0xe9b41) [0x7f0d84ee9b41]
/usr/local/lib/python3.9/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1d9654) [0x7f0d84fd9654]
/usr/local/lib/python3.9/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1bc453) [0x7f0d84fbc453]
/usr/local/lib/python3.9/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(+0x1fd4be) [0x7f0d84ffd4be]
/usr/local/lib/python3.9/site-packages/azure/cognitiveservices/speech/libMicrosoft.CognitiveServices.Speech.core.so(synthesizer_create_speech_synthesizer_from_config+0xf3) [0x7f0d84ea1bd8]
/lib/x86_64-linux-gnu/libffi.so.8(+0x6f7a) [0x7f0d8a053f7a]
/lib/x86_64-linux-gnu/libffi.so.8(+0x640e) [0x7f0d8a05340e]
/lib/x86_64-linux-gnu/libffi.so.8(ffi_call+0xcd) [0x7f0d8a053b0d]
[CALL STACK END]

Runtime error: Failed to initialize platform (azure-c-shared). Error: 2153
ERROR:    closing handshake failed
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/server.py", line 248, in handler
    await self.close()
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 766, in close
    await self.write_close_frame(Close(code, reason))
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1232, in write_close_frame
    await self.write_frame(True, OP_CLOSE, data, _state=State.CLOSING)
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1205, in write_frame
    await self.drain()
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1194, in drain
    await self.ensure_open()
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 935, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: sent 1000 (OK); no close frame received
INFO:     connection closed
@ajar98
Copy link
Contributor

ajar98 commented Jul 3, 2023

fixed in that PR^ :)

@ajar98 ajar98 closed this as completed Jul 3, 2023
@aniket-synth
Copy link

aniket-synth commented Oct 20, 2023

Hi @Van0SS @ajar98 ,
I followed the same steps:
cloned the repo:https://github.com/vocodedev/vocode-python/tree/main/apps/client_backend
updated the .env file

docker build -t vocode-client-backend .
docker run --env-file=.env -p 3000:3000 -t vocode-client-backend

Ran the frontend vocode-react-demo:

npm i
npm run dev

On Using custom backendUrl: "wss:https://localhost:3000/conversation", I am getting the error:
conversation.js:170 WebSocket connection to 'wss:https://localhost:3000/conversation' failed:

@engmsaleh
Copy link

Same issue, any solution?

@engmsaleh
Copy link

I have ended up to downgrade my OpenSSL to 1.1.1 using the answer here

wget https://www.openssl.org/source/openssl-1.1.1o.tar.gz
tar -zxvf openssl-1.1.1o.tar.gz
cd openssl-1.1.1o
./config
make
make test
sudo make install
find / -name libssl.so.1.1
ln -s /usr/local/lib64/libssl.so.1.1  /usr/lib64/libssl.so.1.1
ln -s /usr/local/lib64/libssl.so.1.1  /usr/lib/libssl.so.1.1
find / -name libcrypto.so.1.1
ln -s /home/ubuntu/openssl-1.1.1o/libcrypto.so.1.1    /usr/lib64/libcrypto.so.1.1
ln -s /home/ubuntu/openssl-1.1.1o/libcrypto.so.1.1     /usr/lib/libcrypto.so.1.1

@nitishymtpl
Copy link

Hi, facing same issues. Any solution?

@engmsaleh
Copy link

@nitishymtpl If you have an issue with Ubuntu 22.04 just downgrade to Ubuntu 20.04 and all will work as expected

@nitishymtpl
Copy link

@engmsaleh Could you pls share dockerfile? Thank you :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants