Can't connect to a Clickhouse server that listens on port 443 (or when a reverse proxy on port 443 is used to forward requests to the Clickhouse server on any other port).
The condition in the if is incorrect: when the URL scheme is "http" and the port is explicitely set as "80", then new URL("http://localhost:80").port is equal to the empty string. Similarily, new URL("https://localhost:443").port === "".
This is a regression of version 1.0.0, it works in 0.3.1.
Describe the bug
Can't connect to a Clickhouse server that listens on port 443 (or when a reverse proxy on port 443 is used to forward requests to the Clickhouse server on any other port).
The following code :
Throws the error:
Uncaught Error: ClickHouse URL must contain a valid port number.
This is because of these lines: https://github.com/ClickHouse/clickhouse-js/blob/64b5f8128cef4a868509aec3ce3879c7c9ca841a/packages/client-common/src/config.ts#L286-L288
The condition in the
if
is incorrect: when the URL scheme is "http" and the port is explicitely set as "80", thennew URL("http://localhost:80").port
is equal to the empty string. Similarily,new URL("https://localhost:443").port === ""
.This is a regression of version 1.0.0, it works in 0.3.1.
Configuration
Environment