chproxy icon indicating copy to clipboard operation
chproxy copied to clipboard

[QUESTION] Using chproxy with clickhouse-client with NodeJS

Open asif-git-hub opened this issue 1 year ago • 2 comments

Which feature your question relates to? Using chproxy in a NodeJS application to run queries

Question details I am looking for examples on using chproxy in my nodeJS application.

I am having trouble trying to query our clickhouse table via chproxy from a nodeJS (TS) server-side application: This is how I form the client which passes the health check when I call .ping()

  client = createClient({
    url: getEnvVar("DB_URL"),
    pathname: "play",
    username: getEnvVar("DB_USERNAME"),
    password: getEnvVar("DB_PASSWORD"),
  }) 

When I try to query a table I always keep getting this error: select * from DATABASE.TABLE LIMIT 2;

Error: There is no handle /play?query_id=c152ca33-ac4d-4288-810e-2577b45c9bfc

Use / or /ping for health checks.
Or /replicas_status for more sophisticated health checks.

Additional context/motivations "@clickhouse/client": "^1.8.1", The clickhouse version we are running is 24.3.5

asif-git-hub avatar Nov 16 '24 06:11 asif-git-hub

unfortunately, on the maintainer side, we're only using chproxy with scala, java and golang clients, which works well. I don't understand what the pathname is supposed to be, did you try without it (leave it blank)? Also, did you try directly using clickhouse, if yes, is it working?

mga-chka avatar Feb 04 '25 12:02 mga-chka

@asif-git-hub why do you use /play endpoint? It's not how CH http should be used.

pkit avatar May 06 '25 18:05 pkit