Skip to content

ESP32 SSL connection with error connect(): start_ssl_client: -1 #141

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

Closed
maxdd opened this issue Mar 7, 2021 · 2 comments · Fixed by #143
Closed

ESP32 SSL connection with error connect(): start_ssl_client: -1 #141

maxdd opened this issue Mar 7, 2021 · 2 comments · Fixed by #143

Comments

@maxdd
Copy link

maxdd commented Mar 7, 2021

Steps to reproduce:
List the minimal actions needed to reproduce the behavior.

  1. Use https://github.com/tobiasschuerg/InfluxDB-Client-for-Arduino/blob/master/examples/SecureWrite/SecureWrite.ino
  2. Set client.setInsecure(true);
  3. Set an InfluxDB server with SSL connection

Expected behavior:
Serial should report Serial.print("Connected to InfluxDB: ");

Actual behavior:
Serial is reporting Serial.print("InfluxDB connection failed: ");

3.758 [D] Validating connection to https://192.168.1.23:8086/health
[V][HTTPClient.cpp:239] beginInternal(): url: https://192.168.1.23:8086/health
[D][HTTPClient.cpp:287] beginInternal(): host: 192.168.1.23 port: 8086 url: /health
[D][HTTPClient.cpp:573] sendRequest(): request type: 'GET' redirCount: 0

[V][ssl_client.cpp:59] start_ssl_client(): Free internal heap before TLS 277628
[E][WiFiClientSecure.cpp:127] connect(): start_ssl_client: -1
[V][ssl_client.cpp:265] stop_ssl_socket(): Cleaning SSL connection.
[D][HTTPClient.cpp:1112] connect(): failed connect to 192.168.1.23:8086
[W][HTTPClient.cpp:1411] returnError(): error(-1): connection refused
3.815 [E] Error - connection refused
[D][HTTPClient.cpp:394] disconnect(): tcp is closed

connection refused

Specifications:

  • Library Version: last on github
  • InfluxDB Version: 2 (latest as of today)
  • Board/ESP chip: ESP32 DevKit C
  • Device Arduino SDK version: Platformio 3.1.0 bundle

What im noticing is that WiFiClientSecure::setInsecure() is not called which might lead start_ssl_client(...) to return -1 due to NULLs condition.

EDIT:
There seems to be an issue with INIT_MODE=setup and TLS certificates which is not starting up the influxdb server.
This could be the reason why i'm getting the error above.
I'll check in few days to report any update

@vlastahajek
Copy link
Collaborator

@maxdd, WiFiClientSecure::setInsecure() for ESP32 is supported only since the recent 1.0.5 release. Adding this to the release of the library will break compilation as most users adopt new SDKs slowly.
You can use this fork, where it is prepared.

@codegrue
Copy link

codegrue commented Dec 5, 2023

How did you get HTTPClient to display the extra internal logs such as this one?

[V][HTTPClient.cpp:239] beginInternal(): url: https://192.168.1.23:8086/health

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

Successfully merging a pull request may close this issue.

3 participants