Azure / azure-iot-arduino-protocol-http

Azure IoT HTTP Protocol library for Arduino
Other
9 stars 8 forks source link

TLS failed to start the connection process. #1

Closed joshScienceScope closed 7 years ago

joshScienceScope commented 7 years ago

Hi

I am using an Arduino MKR1000 and trying to get the sample sketch to work. I am getting the following errors in the serial console.

Connected to wifi Fetching NTP epoch time failed! Waiting 5 seconds to retry. Fetched NTP epoch time is: 1484065740 Info: IoT Hub SDK for C, version 1.1.3 IoTHubClient accepted the message for delivery Error: Time:Tue Jan 10 16:29:20 2017 File:C:\Program Files (x86)\Arduino\libraries\azure-iot-arduino-utility\src\adapters\tlsio_arduino.c Func:tlsio_arduino_open Line:264 TLS failed to start the connection process. Error: Time:Tue Jan 10 16:29:20 2017 File:C:\Program Files (x86)\Arduino\libraries\azure-iot-arduino-protocol-http\src\azure_uhttp_c\httpapi_compact.c Func:on_io_error Line:438 Error signalled by underlying IO Error: Time:Tue Jan 10 16:29:20 2017 File:C:\Program Files (x86)\Arduino\libraries\azure-iot-arduino-protocol-http\src\azure_uhttp_c\httpapi_compact.c Func:HTTPAPI_ExecuteRequest Line:1201 Open HTTP connection failed (result = HTTPAPI_OPEN_REQUEST_FAILED) Error: Time:Tue Jan 10 16:29:20 2017 File:C:\Program Files (x86)\Arduino\libraries\azure-iot-arduino-utility\src\azure_c_shared_utility\httpapiex.c Func:HTTPAPIEX_ExecuteRequest Line:478 unable to recover sending to a working state Error: Time:Tue Jan 10 16:29:20 2017 File:C:\Program Files (x86)\Arduino\libraries\azure-iot-arduino\src\sdk\iothubtransporthttp.c Func:DoEvent Line:1622 unable to HTTPAPIEX_SAS_ExecuteRequest

mamokarz commented 7 years ago

There are two most commons facts for TLS failed to start the connection:

  1. The Connection String is not correct. Please double check the host name in the connection string.
  2. Some issue in the SSL library. Please make sure that you are using the latest libraries.
joshScienceScope commented 7 years ago

Hi

I have checked my connection string, it is exactly the same as one i have previously used and had working using a Linux machine.

I have the latest version of the SSL library

I am using Ardunio version 1.6.12

photomoose commented 7 years ago

I had this problem until I upgraded the firmware on the WiFi chip.

I downloaded the latest nightly build of the Arduino IDE (https://www.arduino.cc/en/Main/Software#hourly), then followed the FirmwareUpdater instructions (https://www.arduino.cc/en/Tutorial/FirmwareUpdater) to upgrade the firware to 19.5.2.

If you're using an Adafruit Feather, be sure to set your WiFi pins in the setup() method:

WiFi.setPins(8,7,4,2);

berkaysit commented 6 years ago

I guess you need to upload your IoT Hub certificates to the WiFi device on MKR1000. If you still interested, I can explain how.

mysaggar commented 5 years ago

@photomoose I am receiving this error:

app:94:10: error: 'class ESP8266WiFiClass' has no member named 'setPins'

but before that could you help me with this error:

connected with Moriarty, channel 11 dhcp client start... ip:192.168.43.197,mask:255.255.255.0,gw:192.168.43.1 Connected to wifi Moriarty. Fetched NTP epoch time is: 28812. result = IOTHUB_CLIENT_OK Sending message: {"deviceId":"Feather HUZZAH ESP8266 WiFi","messageId":1,"temperature":29,"humidity":38}. IoTHubClient accepted the message for delivery. TLS failed to start the connection process. Error: io_open failed failure connecting to address iotpra2.azure-devices.net. TLS failed to start the connection process. Error: io_open failed failure connecting to address iotpra2.azure-devices.net. TLS failed to start the connection process. Error: io_open failed failure connecting to address iotpra2.azure-devices.net.

JayGitProfile commented 5 years ago

I'm facing the same error @mysaggar .. I'm trying to connect my nodemcu to iot hub..

Sending message: {"deviceId":"xxxxx","id":"fromNode","temperature":28,"moisture":29}. IoTHubClient accepted the message for delivery. TLS failed to start the connection process. Error: io_open failed

Elgaatoo commented 5 years ago

@mysaggar @JayGitProfile I'm facing the same Problem! 🗡 I've double checked whether the device connection string is wrong, but I see no mistake and Wifi credentials are also right...

connected with XXXX, channel 7 dhcp client start... ip:X.X.X.X.,mask:X.X.X.X,gw:X.X.X.X Connected to wifi XXX Fetched NTP epoch time is: 28849. Sending message: {"deviceId":"Feather HUZZAH ESP8266 WiFi","messageId":1,"temperature":22.7,"humidity":42}. IoTHubClient accepted the message for delivery. TLS failed to start the connection process. Error: io_open failed failure connecting to address EMichelIoTHub.azure-devices.net.

Settings: I'm using board Huzzah ESP8266 2.4.0, Arduino 1.8.9 and libraries:

zhizhengqian commented 5 years ago

I met exactly the same error. I saw some one mentioned that it will work by using HTTP instead of MQTT. I have change the code to:

include

iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString(connectionString, HTTP_Protocol);

But unfortuntely, I am still getting the TSL connection error.

Still haven't found a fix yet.

omk1kor commented 5 years ago

Anyone found a fix for the issue? Facing the same issue with Arduino Nano 33 IOT

arslan437 commented 4 years ago

Hi facing the same issue

hs123xyz commented 4 years ago

I guess you need to upload your IoT Hub certificates to the WiFi device on MKR1000. If you still interested, I can explain how.

@berkaysit yes, that would be great!