Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix destroy of client
adilson8cae72bd4792
diff --git a/backend/src/services/app-connection/snowflake/snowflake-connection-fns.ts b/backend/src/services/app-connection/snowflake/snowflake-connection-fns.tsindex bb0cb5c0cc..134b8cea00 100644--- a/backend/src/services/app-connection/snowflake/snowflake-connection-fns.ts+++ b/backend/src/services/app-connection/snowflake/snowflake-connection-fns.ts@@ -34,27 +34,32 @@ export const getSnowflakeClient = async (credentials: TSnowflakeConnection["credclient.connectAsync((err) => (err ? reject(err) : resolve())).catch(reject);});- let timeoutHandle: NodeJS.Timeout | undefined;- const isValid = await Promise.race<boolean>([- client.isValidAsync(),- new Promise<boolean>((_, reject) => {- timeoutHandle = setTimeout(- () => reject(new BadRequestError({ message: "Snowflake connection validation timed out" })),- 10000- );- })- ]).finally(() => {- if (timeoutHandle) clearTimeout(timeoutHandle);- });-- if (!isValid) {- throw new BadRequestError({- message:- "Snowflake connection is not valid - heartbeat failed; verify credentials, network access, and that the account is not locked"+ try {+ let timeoutHandle: NodeJS.Timeout | undefined;+ const isValid = await Promise.race<boolean>([+ client.isValidAsync(),+ new Promise<boolean>((_, reject) => {+ timeoutHandle = setTimeout(+ () => reject(new BadRequestError({ message: "Snowflake connection validation timed out" })),+ 10000+ );+ })+ ]).finally(() => {+ if (timeoutHandle) clearTimeout(timeoutHandle);});- }- return client;+ if (!isValid) {+ throw new BadRequestError({+ message:+ "Snowflake connection is not valid - heartbeat failed; verify credentials, network access, and that the account is not locked"+ });+ }++ return client;+ } catch (err) {+ client.destroy(noop);+ throw err;+ }};export const executeSnowflakeSql = <TRow = Record<string, unknown>>(