Skip to content

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

fix(errors): add handling for AWS ThrottlingException in classifyError function

Victor Hugo dos Santos4287a52bd517
diff --git a/backend/src/lib/errors/classify.ts b/backend/src/lib/errors/classify.ts
index 68737b91b6..b955fff7c8 100644
--- a/backend/src/lib/errors/classify.ts
+++ b/backend/src/lib/errors/classify.ts
@@ -1,6 +1,8 @@
import { ForbiddenError } from "@casl/ability";
import jwt from "jsonwebtoken";
+import { isAwsError } from "@app/lib/aws/error";
+
import {
BadRequestError,
CryptographyError,
@@ -73,6 +75,8 @@ export const classifyError = (err: unknown): ErrorType => {
if (err instanceof OidcAuthError) return "oidc";
if (err instanceof InternalServerError) return "internal";
+ if (isAwsError(err, "ThrottlingException")) return "rate_limit";
+
const code = getErrorCode(err);
if (code === "ECONNABORTED" || code === "ETIMEDOUT") return "timeout";
if (code === "ECONNRESET" || code === "ENOTFOUND" || code === "ECONNREFUSED") return "network";