MQTT to AWS IoT Core fails with mbedtls_ssl_handshake_error
mbedtls_ssl_handshake error: -2880
I (14912) wifi:Traceback (most recent call last):
File "main.py", line 99, in <module>
File "main.py", line 96, in <module>
File "main.py", line 69, in mqtt
File "umqtt/simple.py", line 61, in connect
OSError: [Errno 5] EIO
Fails on the latest firmware but works on any of the 2019 builds - tried it with esp32-idf3-20191220-v1.12.bin and it works but needed BLE and hence upgraded to 2020 versions and fails on all the March/April releases.
urllib.urequest.urlopen fails with mbedtls_ssl_handshake error on ESP32
I'm running into problems when trying to make an HTTP request to one particular page using urllib.urequest installed by upip in micropython (version micropython/micropython@eae495a71 with russhughes/st7789_mpy@ff343dc compiled in):
>>> from urllib.urequest import urlopen
>>> res = urlopen('https://aladinonline.androworks.org/')
mbedtls_ssl_handshake error: -4290
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/lib/urllib/urequest.py", line 30, in urlopen
OSError: [Errno 5] EIO
The WiFi connection seems to be working because I can connect to other pages just fine, I didn't find a single page other than this one that would fail with the same error. I tried looking for the -4290 error code in mbedtls documentation, but I couldn't find anything.
The big picture here is that I'm trying to build a tiny weather station with the TTGO T-Display board. The page that I'm trying to connect here offers a very convenient API for data from a particular atmospheric model used for the weather forecast in Europe (ALADIN). My initial goal is to make a request to the API, store the response (which contains a forecast for the next two days) and show some information from it on the board's display. This is my first micropython project though and I have no clue how to debug the issue further. Any ideas?
I tried looking into urlopen code, and I managed to replicate the issue using just micropython library, this time using vanilla micropython version
v1.12-256-geae495a71from the site's download page, but I'm unsure what to do next. The following fails with the same error as theurlopencall, suggesting this might be a bug in micropython itself, not in micropython-lib's implementation ofurllib:The micropython documentation, however, doesn't say anything about the
server_hostnameparameter ofussl.wrap_socketfunction. If I omit the parameter, the connection works fine:but since the parameter isn't documented, I don't know what other side effects this change has. Is this a micropython bug and should I open an issue there (and close this one), or does it belong here?
Hi - had the same issue an i downgraded the ESP Firmware to esp32-idf3-20191220-v1.12.bin
after flashing the board with the stable release - it worked for me.
Oh, you're right @mardigras2020, it does work with esp32-idf3-20191220-v1.12.bin. I didn't even realise the other one was a nightly version when I downloaded it, that's why I didn't try it with a stable one. Now it really seems like a bug in micropython itself. I'll try to find out which commit introduced it, open an issue in the other repository and close this one.
Closing the issue as this seems to be a micropython bug after all.