Skip to content

pyarrow._flight.FlightUnavailableError: Flight returned unavailable error, with message: failed to connect to all addresses; last error: UNKNOWN: Ssl handshake failed: SSL_ERROR_SSL #117

@PetrSimik

Description

@PetrSimik

Specifications

  • Client Version: influxdb3-python 0.10.0
  • InfluxDB Version: influxdb:20240819-1176644
  • Platform: MacOS Sequoia Version 15.2 (24C101)

Code sample to reproduce problem

from influxdb_client_3 import InfluxDBClient3


host = "influx.ntw.xxx.yyy"
database_name = "test/5m"
token = "my_api_key"
table = "test"

client = InfluxDBClient3(host=host,
                        database=database_name,
                        token=token,
                        verify_ssl=False,
                        
                        )

result = client.query("SELECT * from test")

print(result)

Expected behavior

(.venv) petr@test:~/influx3-playground$ python influx3_read.py
pyarrow.Table
co: int64
hum: double
room: string
sensor: string
temp: double
time: timestamp[ns] not null

co: [[0,0,0,0,0,1,0,0,0,0,0],[0],[4]]
hum: [[35.9,36.2,36.1,36,36,36.5,35.9,35.9,36,36,35.9],[36],[36.9]]
room: [["Kitchen","Kitchen","Kitchen","Kitchen","Kitchen","Kitchen","Living Room","Living Room","Living Room","Living Room","Living Room"],["Living Room"],["garaga"]]
sensor: [[null,null,null,null,null,null,null,null,null,null,null],[null],["K001"]]
temp: [[21,23,22.7,22.4,22.5,22.8,21.1,21.4,21.8,22.2,22.2],[22.4],[72.2]]
time: [[2024-12-19 11:40:00.000000000,2024-12-19 12:40:00.000000000,2024-12-19 13:40:00.000000000,2024-12-19 14:40:00.000000000,2024-12-19 15:40:00.000000000,2024-12-19 16:40:00.000000000,2024-12-19 11:40:00.000000000,2024-12-19 12:40:00.000000000,2024-12-19 13:40:00.000000000,2024-12-19 14:40:00.000000000,2024-12-19 15:40:00.000000000],[2024-12-19 16:40:00.000000000],[2024-12-18 20:00:00.000000000]]

Actual behavior

E0123 06:31:31.376124000 8673821248 ssl_transport_security.cc:1501] Handshake failed with fatal error SSL_ERROR_SSL: error:0A000086:SSL routines::certificate verify failed.
Traceback (most recent call last):
File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/influx3_read.py", line 17, in
result = client.query("SELECT * from test")
File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/.venv/lib/python3.13/site-packages/influxdb_client_3/init.py", line 267, in query
return self._query_api.query(query=query, language=language, mode=mode, database=database, **kwargs)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/.venv/lib/python3.13/site-packages/influxdb_client_3/query/query_api.py", line 97, in query
raise e
File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/.venv/lib/python3.13/site-packages/influxdb_client_3/query/query_api.py", line 81, in query
flight_reader = self._do_get(ticket, _options)
File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/.venv/lib/python3.13/site-packages/influxdb_client_3/query/query_api.py", line 100, in _do_get
return self._flight_client.do_get(ticket, options)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "pyarrow/_flight.pyx", line 1633, in pyarrow._flight.FlightClient.do_get
File "pyarrow/_flight.pyx", line 68, in pyarrow._flight.check_flight_status
pyarrow._flight.FlightUnavailableError: Flight returned unavailable error, with message: failed to connect to all addresses; last error: UNKNOWN: ipv4:10.58.71.20:443: Ssl handshake failed: SSL_ERROR_SSL: error:0A000086:SSL routines::certificate verify failed. gRPC client debug context: UNKNOWN:failed to connect to all addresses; last error: UNKNOWN: ipv4:10.58.71.20:443: Ssl handshake failed: SSL_ERROR_SSL: error:0A000086:SSL routines::certificate verify failed {grpc_status:14, created_time:"2025-01-23T06:31:31.378154+01:00"}. Client context: IOError: Server never sent a data message. Detail: Internal

Additional info

So I tried ssl False, enforce context or all other options and still getting the err

`python
from influxdb_client_3 import InfluxDBClient3
import ssl

cert_path = "influx.ntw.xxx.yy.pem"
ssl_context = ssl.create_default_context(cafile=cert_path)

host = "influx.ntw..xxx.yy"
database_name = "test_petr/5m"
token = "token"
table = "test"

client = InfluxDBClient3(host=host,
database=database_name,
token=token,
# verify_ssl=False,
ssl_context=ssl_context
)

result = client.query("SELECT * from test")

print(result)
`

the same err:

E0123 11: 47:58.190666000 8673821248 ssl_transport_security.cc:1501] Handshake failed with fatal error SSL_ERROR_SSL: error:0A000086:SSL routines::certificate verify failed. Traceback (most recent call last): File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/influx3_read.py", line 19, in <module> result = client.query("SELECT * from test") File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/.venv/lib/python3.13/site-packages/influxdb_client_3/__init__.py", line 267, in query return self._query_api.query(query=query, language=language, mode=mode, database=database, **kwargs) ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/.venv/lib/python3.13/site-packages/influxdb_client_3/query/query_api.py", line 97, in query raise e File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/.venv/lib/python3.13/site-packages/influxdb_client_3/query/query_api.py", line 81, in query flight_reader = self._do_get(ticket, _options) File "/Users/petrsimik/Projects/Work/network.git.cz.o2/influx3-playground/.venv/lib/python3.13/site-packages/influxdb_client_3/query/query_api.py", line 100, in _do_get return self._flight_client.do_get(ticket, options) ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "pyarrow/_flight.pyx", line 1633, in pyarrow._flight.FlightClient.do_get File "pyarrow/_flight.pyx", line 68, in pyarrow._flight.check_flight_status pyarrow._flight.FlightUnavailableError: Flight returned unavailable error, with message: failed to connect to all addresses; last error: UNKNOWN: ipv4:10.58.71.20:443: Ssl handshake failed: SSL_ERROR_SSL: error:0A000086:SSL routines::certificate verify failed. gRPC client debug context: UNKNOWN:failed to connect to all addresses; last error: UNKNOWN: ipv4:10.58.71.20:443: Ssl handshake failed: SSL_ERROR_SSL: error:0A000086:SSL routines::certificate verify failed {grpc_status:14, created_time:"2025-01-23T11:47:58.191946+01:00"}. Client context: IOError: Server never sent a data message. Detail: Internal

checking ssl handshake works
`
import ssl
import socket

def evaluate_ssl_handshake(host, port=443):
try:
# Create a custom SSL context with your CA bundle
context = ssl.create_default_context(cafile="influx.ntw.xxx.yy.pem")

    # Set up the socket with an SSL context
    with socket.create_connection((host, port)) as sock:
        with context.wrap_socket(sock, server_hostname=host) as ssl_sock:
            # Print SSL/TLS certificate details
            cert = ssl_sock.getpeercert()
            print(f"SSL handshake to {host} successful!")
            print("Certificate details:")
            for key, value in cert.items():
                print(f"{key}: {value}")
            print(f"TLS version: {ssl_sock.version()}")
            print(f"Cipher suite: {ssl_sock.cipher()}")
except ssl.SSLError as e:
    print(f"SSL handshake failed: {e}")
except Exception as e:
    print(f"An error occurred: {e}")

Specify the host and port

host = "influx.ntw..xxx.yy"
evaluate_ssl_handshake(host)
`
this results
python stash/shake2.py
SSL handshake to influx.ntw.xxx.yy successful!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions