fix: AI Notebook CH connections need to send pw (#1792)

A user reported that they could not use the Notebooks feature due to a random clickhouse connection failure, pointing to a bad password. https://discord.com/channels/1149498480893640706/1149500035403350036/1473446917198315563

The reason it failed was because we weren't selecting the pw in `mongo` prior to using it in a direct `CH` connection. 

Before the fix, the call in `getAIMetadata` omitted the `selectPassword` argument:
`const connection = await getConnectionById(source.team.toString(), connectionId); // connection.password === undefined`

So when the ClickhouseClient was constructed immediately after:
```
const clickhouseClient = new ClickhouseClient({ host: connection.host, username: connection.username, password: connection.password,  });
```

`connection.password` was undefined, and the ClickHouse client connected with no password — hence the authentication failure.

The fix just adds `true` so the password is actually fetched from MongoDB and present in connection.password when the client is constructed.
This commit is contained in:
Tom Alexander 2026-02-24 10:08:55 -05:00 committed by GitHub
parent cd2b7a7615
commit 5474409317
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
"@hyperdx/api": patch
---
fix: AI Notebook CH connections need to send pw

View file

@ -78,6 +78,7 @@ export async function getAIMetadata(source: ISource) {
const connection = await getConnectionById(
source.team.toString(),
connectionId,
true,
);
if (connection == null) {