Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: increase connection timeouts for improved stability

Victor Hugo dos Santosb23bb6003777
diff --git a/backend/src/lib/gateway-v2/gateway-v2.ts b/backend/src/lib/gateway-v2/gateway-v2.ts
index 8aeed6c1ed..16eb8e8ca7 100644
--- a/backend/src/lib/gateway-v2/gateway-v2.ts
+++ b/backend/src/lib/gateway-v2/gateway-v2.ts
@@ -65,12 +65,12 @@ export const createRelayConnection = async ({
});
socket.on("timeout", () => {
- logger.error(`TLS connection timeout after 30 seconds`);
+ logger.error(`TLS connection timeout after 120 seconds`);
socket.destroy();
reject(new Error("TLS connection timeout"));
});
- socket.setTimeout(30000);
+ socket.setTimeout(100000);
} catch (error: unknown) {
reject(new Error(`Failed to create TLS connection: ${error instanceof Error ? error.message : String(error)}`));
}
@@ -122,7 +122,7 @@ export const createGatewayConnection = async (
reject(new Error(`Failed to establish gateway mTLS: ${err.message}`));
});
- gatewaySocket.setTimeout(30000);
+ gatewaySocket.setTimeout(120000);
gatewaySocket.on("timeout", () => {
gatewaySocket.destroy();
reject(new Error("Gateway connection timeout"));
diff --git a/backend/src/server/app.ts b/backend/src/server/app.ts
index fefeb42f0f..5eaf1b31f7 100644
--- a/backend/src/server/app.ts
+++ b/backend/src/server/app.ts
@@ -75,7 +75,7 @@ export const main = async ({
genReqId: () => `req-${alphaNumericNanoId(14)}`,
trustProxy: true,
- connectionTimeout: appCfg.isHsmConfigured ? 90_000 : 70_000,
+ connectionTimeout: 100_000,
ignoreTrailingSlash: true,
pluginTimeout: 40_000
}).withTypeProvider<ZodTypeProvider>();
diff --git a/backend/src/services/app-connection/ssh/ssh-connection-fns.ts b/backend/src/services/app-connection/ssh/ssh-connection-fns.ts
index e1e7ef37b3..2b9f197339 100644
--- a/backend/src/services/app-connection/ssh/ssh-connection-fns.ts
+++ b/backend/src/services/app-connection/ssh/ssh-connection-fns.ts
@@ -12,7 +12,7 @@ import { AppConnection } from "@app/services/app-connection/app-connection-enums
import { SshConnectionMethod } from "./ssh-connection-enums";
import { TSshConnectionConfig } from "./ssh-connection-types";
-const SSH_TIMEOUT = 45_000;
+const SSH_TIMEOUT = 50_000;
const SSH_RETRY_DELAY = 5_000;
const SSH_MAX_RETRIES = 2;
@@ -107,7 +107,8 @@ const attemptSshConnection = (
};
const isRetryableError = (errorMessage: string): boolean => {
- return errorMessage.toLowerCase().includes("timeout");
+ const lowerMessage = errorMessage.toLowerCase();
+ return lowerMessage.includes("timeout") || lowerMessage.includes("timed out");
};
export const getSshConnectionClient = async (