Skip to content

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

fix: addressed instance of comment

Sheen Capadngan596e9d181cb0
diff --git a/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts b/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts
index 8a32c0fbb0..9bcfd82c77 100644
--- a/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts
+++ b/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts
@@ -26,7 +26,7 @@ import {
isPqcCryptoKey
} from "@app/lib/crypto/pqc";
import { DatabaseErrorCode } from "@app/lib/error-codes";
-import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
+import { BadRequestError, DatabaseError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
import { ms } from "@app/lib/ms";
import { alphaNumericNanoId } from "@app/lib/nanoid";
import { ActorAuthMethod, ActorType } from "@app/services/auth/auth-type";
@@ -502,7 +502,10 @@ export const internalCertificateAuthorityServiceFactory = ({
)
.catch((error) => {
// unique_violation: same CA name in the same project
- if ((error as { error?: { code?: string } })?.error?.code === DatabaseErrorCode.UniqueViolation) {
+ if (
+ error instanceof DatabaseError &&
+ (error.error as { code?: string })?.code === DatabaseErrorCode.UniqueViolation
+ ) {
throw new BadRequestError({
message: `A certificate authority named "${resolvedCaName}" already exists.`
});