Streamlit webrtc error

I’m trying to stream video input from webcam using webrtc_streamer and I’m facing some errors
Here is the python script code.

Code snippet:

import streamlit as st
from streamlit_webrtc import webrtc_streamer

st.title("My first Streamlit app")
st.write("Hello, world")


The error message I’m getting is

2023-01-05 22:24:26.417 Uncaught app exception
Traceback (most recent call last):
  File "D:\Anaconda\envs\Simbolo\lib\site-packages\streamlit\runtime\scriptrunner\", line 565, in _run_script
    exec(code, module.__dict__)
  File "C:\Users\Aung Sann Thit\Pycharm\Projects\SLR_Word_Level\", line 11, in <module>
  File "D:\Anaconda\envs\Simbolo\lib\site-packages\streamlit_webrtc\", line 589, in webrtc_streamer
    webrtc_worker.process_offer(sdp_offer["sdp"], sdp_offer["type"])
  File "D:\Anaconda\envs\Simbolo\lib\site-packages\streamlit_webrtc\", line 583, in process_offer
    raise result
  File "D:\Anaconda\envs\Simbolo\lib\site-packages\streamlit_webrtc\", line 225, in _process_offer_coro
    await pc.setRemoteDescription(offer)
  File "D:\Anaconda\envs\Simbolo\lib\site-packages\aiortc\", line 828, in setRemoteDescription
    transceiver = self.__createTransceiver(
  File "D:\Anaconda\envs\Simbolo\lib\site-packages\aiortc\", line 1067, in __createTransceiver
    dtlsTransport = self.__createDtlsTransport()
  File "D:\Anaconda\envs\Simbolo\lib\site-packages\aiortc\", line 1044, in __createDtlsTransport
    dtlsTransport = RTCDtlsTransport(iceTransport, self.__certificates)
  File "D:\Anaconda\envs\Simbolo\lib\site-packages\aiortc\", line 375, in __init__
    self.__ctx = certificate._create_ssl_context()
  File "D:\Anaconda\envs\Simbolo\lib\site-packages\aiortc\", line 211, in _create_ssl_context
    _openssl_assert(lib.SSL_CTX_use_certificate(ctx, self._cert._x509) == 1)  # type: ignore
AttributeError: 'builtins.Certificate' object has no attribute '_x509'
1 Like

Hi @AungSannThit2000!

And welcome to our forums! :hugs:

The error message says that the Certificate object has no attribute _x509, which suggests that there is a problem with the certificate being passed.

Give this a tweak and see if it fixes the issue. If not, we can take another look :slight_smile:


Hi @Charly_Wargnier thanks for your reply. Can u elaborate further on what is the Certificate object or where can I learn about it. I’m new to coding and stuff. Can u please guide me to the resources on it if u don’t mind.

Edit: I tried updating openssl from cmd promt and I still get the error

Thanks @AungSannThit2000

I’m not too familiar with WebRTC, so I’m going to loop in @whitphx, the creator of the WebRTC component, as I think he might be able to provide more insight on the issue you’re experiencing :slight_smile:


Please try the latest release of streamlit-webrtc (0.44.1) that I just published :slight_smile:

This problem and its solution were reported at AttributeError: 'builtins.Certificate' object has no attribute '_x509' · Issue #1164 · whitphx/streamlit-webrtc · GitHub, then I published a new version of streamlit-webrtc with the fix.

It looks like the recently released version of cryptography, 0.39.0 (cryptography · PyPI) causes this problem, and it is discussed at Certificate error when creating RTCDtlsTransport with Cryptography 39.0.0 · Issue #804 · aiortc/aiortc · GitHub

Thanks @whitphx. I updated my streamlit_webrtc and it works now. Thanks for the update.