ClickHouse / clickhouse-js

Official JS client for ClickHouse DB
https://clickhouse.com
Apache License 2.0
225 stars 27 forks source link

Authentication failed: password is incorrect or there is no user with such name. #126

Closed SimonVillage closed 1 year ago

SimonVillage commented 1 year ago

Working curl example

echo 'SELECT version()' | curl 'https://analytics:analytics3113@***:8123/?database=analytics' --data-binary @-

Error throwing javascript example

const client = createClient({
  host: "https://***:8123",
  username: "analytics",
  password: "analytics3113",
  database: "analytics",
});

Error

error: Uncaught Error: default: Authentication failed: password is incorrect or there is no user with such name.

In both cases da domain was used with valid ssl certificate.

slvrtrn commented 1 year ago

Hmm, that's hard to tell straight away what might be wrong here. But the port looks a bit odd, it is usually 8443 instead of 8123 for HTTPS. I assume this is a self-hosted configuration?

SimonVillage commented 1 year ago

True, should be 8443, however, with 8123 / http I am getting the same error.

My endpoint http://***:8123 returns Ok.

curl

➜  ~ echo 'SELECT version()' | curl 'http://analytics:analytics3113@***:8123/?database=analytics' --data-binary @-
22.11.2.30

working javascript connection

const db = createClient({
  host: "http://analytics:analytics3113@***:8123",
  // username: "analytics",
  // password: "analytics3113",
  database: "analytics",
});

not working connection

const client = createClient({
  host: "http://***:8123",
  username: "analytics",
  password: "analytics3113",
  database: "analytics",
});

Error

error: Uncaught Error: default: Authentication failed: password is incorrect or there is no user with such name. 
slvrtrn commented 1 year ago

I'd appreciate it if you could join our community slack and share your server configuration and exact code snippets with me there. It will help with the debugging of this scenario.

SimonVillage commented 1 year ago

Issue seems to be with Deno. I am not sure what exactly causes the problem but it doesn't seem to be a direct issue with ClickHouse javascript module.