Skip to content

Commit 5474409

Browse files
authored
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.
1 parent cd2b7a7 commit 5474409

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎.changeset/sour-feet-act.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hyperdx/api": patch
3+
---
4+
5+
fix: AI Notebook CH connections need to send pw

‎packages/api/src/controllers/ai.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export async function getAIMetadata(source: ISource) {
7878
const connection = await getConnectionById(
7979
source.team.toString(),
8080
connectionId,
81+
true,
8182
);
8283

8384
if (connection == null) {

0 commit comments

Comments
 (0)