Skip to content

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

Fix error typing

x032205bfb2486204bd
diff --git a/backend/src/services/app-connection/hc-vault/hc-vault-connection-fns.ts b/backend/src/services/app-connection/hc-vault/hc-vault-connection-fns.ts
index 44b18f30f7..46a59bcecb 100644
--- a/backend/src/services/app-connection/hc-vault/hc-vault-connection-fns.ts
+++ b/backend/src/services/app-connection/hc-vault/hc-vault-connection-fns.ts
@@ -79,11 +79,12 @@ export const requestWithHCVaultGateway = async <T>(
try {
return await request.request(finalRequestConfig);
} catch (error) {
- const axiosError = error as AxiosError;
- logger.error(
- { message: axiosError.message, data: axiosError.response?.data },
- "Error during HashiCorp Vault gateway request:"
- );
+ if (error instanceof AxiosError) {
+ logger.error(
+ { message: error.message, data: (error.response as undefined | { data: unknown })?.data },
+ "Error during HashiCorp Vault gateway request:"
+ );
+ }
throw error;
}
},