Skip to content

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

refactor: use IdentityAuthMethod enum and add error logging to telemetry calls

Devin AI2cac90b05cf2
diff --git a/backend/src/server/routes/v1/identity-alicloud-auth-router.ts b/backend/src/server/routes/v1/identity-alicloud-auth-router.ts
index 79e6687b9a..7d358e54e6 100644
--- a/backend/src/server/routes/v1/identity-alicloud-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-alicloud-auth-router.ts
@@ -1,7 +1,8 @@
import RE2 from "re2";
import { z } from "zod";
-import { IdentityAlicloudAuthsSchema } from "@app/db/schemas";
+import { IdentityAlicloudAuthsSchema, IdentityAuthMethod } from "@app/db/schemas";
+import { logger } from "@app/lib/logger";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ALICLOUD_AUTH, ApiDocsTags } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
@@ -102,10 +103,10 @@ export const registerIdentityAliCloudAuthRouter = async (server: FastifyZodProvi
properties: {
identityId: identityAliCloudAuth.identityId,
orgId: identity.orgId,
- authMethod: "alicloud"
+ authMethod: IdentityAuthMethod.ALICLOUD_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return {
accessToken,
@@ -213,10 +214,10 @@ export const registerIdentityAliCloudAuthRouter = async (server: FastifyZodProvi
properties: {
identityId: identityAliCloudAuth.identityId,
orgId: identityAliCloudAuth.orgId,
- authMethod: "alicloud"
+ authMethod: IdentityAuthMethod.ALICLOUD_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityAliCloudAuth };
}
@@ -319,10 +320,10 @@ export const registerIdentityAliCloudAuthRouter = async (server: FastifyZodProvi
properties: {
identityId: identityAliCloudAuth.identityId,
orgId: identityAliCloudAuth.orgId,
- authMethod: "alicloud"
+ authMethod: IdentityAuthMethod.ALICLOUD_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityAliCloudAuth };
}
@@ -431,10 +432,10 @@ export const registerIdentityAliCloudAuthRouter = async (server: FastifyZodProvi
properties: {
identityId: identityAliCloudAuth.identityId,
orgId: identityAliCloudAuth.orgId,
- authMethod: "alicloud"
+ authMethod: IdentityAuthMethod.ALICLOUD_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityAliCloudAuth };
}
diff --git a/backend/src/server/routes/v1/identity-aws-iam-auth-router.ts b/backend/src/server/routes/v1/identity-aws-iam-auth-router.ts
index 9c0b24a6b1..e1dbc157c2 100644
--- a/backend/src/server/routes/v1/identity-aws-iam-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-aws-iam-auth-router.ts
@@ -1,6 +1,7 @@
import { z } from "zod";
-import { IdentityAwsAuthsSchema } from "@app/db/schemas";
+import { IdentityAuthMethod, IdentityAwsAuthsSchema } from "@app/db/schemas";
+import { logger } from "@app/lib/logger";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, AWS_AUTH } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
@@ -69,10 +70,10 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityAwsAuth.identityId,
orgId: identity.orgId,
- authMethod: "aws_iam"
+ authMethod: IdentityAuthMethod.AWS_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return {
accessToken,
@@ -184,10 +185,10 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityAwsAuth.identityId,
orgId: identityAwsAuth.orgId,
- authMethod: "aws_iam"
+ authMethod: IdentityAuthMethod.AWS_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityAwsAuth };
}
@@ -282,10 +283,10 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityAwsAuth.identityId,
orgId: identityAwsAuth.orgId,
- authMethod: "aws_iam"
+ authMethod: IdentityAuthMethod.AWS_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityAwsAuth };
}
@@ -394,10 +395,10 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityAwsAuth.identityId,
orgId: identityAwsAuth.orgId,
- authMethod: "aws_iam"
+ authMethod: IdentityAuthMethod.AWS_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityAwsAuth };
}
diff --git a/backend/src/server/routes/v1/identity-azure-auth-router.ts b/backend/src/server/routes/v1/identity-azure-auth-router.ts
index 5f22fa8dd4..a16418ad7d 100644
--- a/backend/src/server/routes/v1/identity-azure-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-azure-auth-router.ts
@@ -1,6 +1,7 @@
import { z } from "zod";
-import { IdentityAzureAuthsSchema } from "@app/db/schemas";
+import { IdentityAuthMethod, IdentityAzureAuthsSchema } from "@app/db/schemas";
+import { logger } from "@app/lib/logger";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, AZURE_AUTH } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
@@ -64,10 +65,10 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
properties: {
identityId: identityAzureAuth.identityId,
orgId: identity.orgId,
- authMethod: "azure"
+ authMethod: IdentityAuthMethod.AZURE_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return {
accessToken,
@@ -178,10 +179,10 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
properties: {
identityId: identityAzureAuth.identityId,
orgId: identityAzureAuth.orgId,
- authMethod: "azure"
+ authMethod: IdentityAuthMethod.AZURE_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityAzureAuth };
}
@@ -282,10 +283,10 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
properties: {
identityId: identityAzureAuth.identityId,
orgId: identityAzureAuth.orgId,
- authMethod: "azure"
+ authMethod: IdentityAuthMethod.AZURE_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityAzureAuth };
}
@@ -395,10 +396,10 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
properties: {
identityId: identityAzureAuth.identityId,
orgId: identityAzureAuth.orgId,
- authMethod: "azure"
+ authMethod: IdentityAuthMethod.AZURE_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityAzureAuth };
}
diff --git a/backend/src/server/routes/v1/identity-gcp-auth-router.ts b/backend/src/server/routes/v1/identity-gcp-auth-router.ts
index 4a6d1e563a..39c54995d4 100644
--- a/backend/src/server/routes/v1/identity-gcp-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-gcp-auth-router.ts
@@ -1,6 +1,7 @@
import { z } from "zod";
-import { IdentityGcpAuthsSchema } from "@app/db/schemas";
+import { IdentityAuthMethod, IdentityGcpAuthsSchema } from "@app/db/schemas";
+import { logger } from "@app/lib/logger";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, GCP_AUTH } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
@@ -64,10 +65,10 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityGcpAuth.identityId,
orgId: identity.orgId,
- authMethod: "gcp"
+ authMethod: IdentityAuthMethod.GCP_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return {
accessToken,
@@ -176,10 +177,10 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityGcpAuth.identityId,
orgId: identityGcpAuth.orgId,
- authMethod: "gcp"
+ authMethod: IdentityAuthMethod.GCP_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityGcpAuth };
}
@@ -276,10 +277,10 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityGcpAuth.identityId,
orgId: identityGcpAuth.orgId,
- authMethod: "gcp"
+ authMethod: IdentityAuthMethod.GCP_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityGcpAuth };
}
@@ -389,10 +390,10 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityGcpAuth.identityId,
orgId: identityGcpAuth.orgId,
- authMethod: "gcp"
+ authMethod: IdentityAuthMethod.GCP_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityGcpAuth };
}
diff --git a/backend/src/server/routes/v1/identity-jwt-auth-router.ts b/backend/src/server/routes/v1/identity-jwt-auth-router.ts
index 7ea6a0a4f3..3b662f64df 100644
--- a/backend/src/server/routes/v1/identity-jwt-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-jwt-auth-router.ts
@@ -1,6 +1,7 @@
import { z } from "zod";
-import { IdentityJwtAuthsSchema } from "@app/db/schemas";
+import { IdentityAuthMethod, IdentityJwtAuthsSchema } from "@app/db/schemas";
+import { logger } from "@app/lib/logger";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, JWT_AUTH } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
@@ -140,10 +141,10 @@ export const registerIdentityJwtAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityJwtAuth.identityId,
orgId: identity.orgId,
- authMethod: "jwt"
+ authMethod: IdentityAuthMethod.JWT_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return {
accessToken,
@@ -226,10 +227,10 @@ export const registerIdentityJwtAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityJwtAuth.identityId,
orgId: identityJwtAuth.orgId,
- authMethod: "jwt"
+ authMethod: IdentityAuthMethod.JWT_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return {
identityJwtAuth
@@ -308,10 +309,10 @@ export const registerIdentityJwtAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityJwtAuth.identityId,
orgId: identityJwtAuth.orgId,
- authMethod: "jwt"
+ authMethod: IdentityAuthMethod.JWT_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityJwtAuth };
}
@@ -424,10 +425,10 @@ export const registerIdentityJwtAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityJwtAuth.identityId,
orgId: identityJwtAuth.orgId,
- authMethod: "jwt"
+ authMethod: IdentityAuthMethod.JWT_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityJwtAuth };
}
diff --git a/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts b/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts
index d806d9e315..d179547f5c 100644
--- a/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts
@@ -1,6 +1,7 @@
import { z } from "zod";
-import { IdentityKubernetesAuthsSchema } from "@app/db/schemas";
+import { IdentityAuthMethod, IdentityKubernetesAuthsSchema } from "@app/db/schemas";
+import { logger } from "@app/lib/logger";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, KUBERNETES_AUTH } from "@app/lib/api-docs";
import { CharacterType, characterValidator } from "@app/lib/validator/validate-string";
@@ -85,10 +86,10 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
properties: {
identityId: identityKubernetesAuth.identityId,
orgId: identity.orgId,
- authMethod: "kubernetes"
+ authMethod: IdentityAuthMethod.KUBERNETES_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return {
accessToken,
@@ -251,10 +252,10 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
properties: {
identityId: identityKubernetesAuth.identityId,
orgId: identityKubernetesAuth.orgId,
- authMethod: "kubernetes"
+ authMethod: IdentityAuthMethod.KUBERNETES_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityKubernetesAuth: IdentityKubernetesAuthResponseSchema.parse(identityKubernetesAuth) };
}
@@ -408,10 +409,10 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
properties: {
identityId: identityKubernetesAuth.identityId,
orgId: identityKubernetesAuth.orgId,
- authMethod: "kubernetes"
+ authMethod: IdentityAuthMethod.KUBERNETES_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityKubernetesAuth };
}
@@ -524,10 +525,10 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
properties: {
identityId: identityKubernetesAuth.identityId,
orgId: identityKubernetesAuth.orgId,
- authMethod: "kubernetes"
+ authMethod: IdentityAuthMethod.KUBERNETES_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityKubernetesAuth };
}
diff --git a/backend/src/server/routes/v1/identity-ldap-auth-router.ts b/backend/src/server/routes/v1/identity-ldap-auth-router.ts
index 783d4e1371..ba2f572461 100644
--- a/backend/src/server/routes/v1/identity-ldap-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-ldap-auth-router.ts
@@ -14,6 +14,7 @@ import LdapStrategy from "passport-ldapauth";
import { z } from "zod";
import { IdentityLdapAuthsSchema } from "@app/db/schemas/identity-ldap-auths";
+import { IdentityAuthMethod } from "@app/db/schemas";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { isValidLdapFilter } from "@app/ee/services/ldap-config/ldap-fns";
import { ApiDocsTags, LDAP_AUTH } from "@app/lib/api-docs";
@@ -212,10 +213,10 @@ export const registerIdentityLdapAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: authIdentityId,
orgId: identity.orgId,
- authMethod: "ldap"
+ authMethod: IdentityAuthMethod.LDAP_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return {
accessToken,
@@ -422,10 +423,10 @@ export const registerIdentityLdapAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityLdapAuth.identityId,
orgId: req.permission.orgId,
- authMethod: "ldap"
+ authMethod: IdentityAuthMethod.LDAP_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityLdapAuth };
}
@@ -557,10 +558,10 @@ export const registerIdentityLdapAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityLdapAuth.identityId,
orgId: req.permission.orgId,
- authMethod: "ldap"
+ authMethod: IdentityAuthMethod.LDAP_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityLdapAuth };
}
@@ -683,10 +684,10 @@ export const registerIdentityLdapAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityLdapAuth.identityId,
orgId: req.permission.orgId,
- authMethod: "ldap"
+ authMethod: IdentityAuthMethod.LDAP_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityLdapAuth };
}
diff --git a/backend/src/server/routes/v1/identity-oci-auth-router.ts b/backend/src/server/routes/v1/identity-oci-auth-router.ts
index 0a41617551..74a8d3b3a2 100644
--- a/backend/src/server/routes/v1/identity-oci-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-oci-auth-router.ts
@@ -1,6 +1,7 @@
import { z } from "zod";
-import { IdentityOciAuthsSchema } from "@app/db/schemas";
+import { IdentityAuthMethod, IdentityOciAuthsSchema } from "@app/db/schemas";
+import { logger } from "@app/lib/logger";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, OCI_AUTH } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
@@ -81,10 +82,10 @@ export const registerIdentityOciAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityOciAuth.identityId,
orgId: identity.orgId,
- authMethod: "oci"
+ authMethod: IdentityAuthMethod.OCI_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return {
accessToken,
@@ -189,10 +190,10 @@ export const registerIdentityOciAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityOciAuth.identityId,
orgId: identityOciAuth.orgId,
- authMethod: "oci"
+ authMethod: IdentityAuthMethod.OCI_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityOciAuth };
}
@@ -286,10 +287,10 @@ export const registerIdentityOciAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityOciAuth.identityId,
orgId: identityOciAuth.orgId,
- authMethod: "oci"
+ authMethod: IdentityAuthMethod.OCI_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityOciAuth };
}
@@ -398,10 +399,10 @@ export const registerIdentityOciAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityOciAuth.identityId,
orgId: identityOciAuth.orgId,
- authMethod: "oci"
+ authMethod: IdentityAuthMethod.OCI_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityOciAuth };
}
diff --git a/backend/src/server/routes/v1/identity-oidc-auth-router.ts b/backend/src/server/routes/v1/identity-oidc-auth-router.ts
index 8405b99f7c..3d4890a4c5 100644
--- a/backend/src/server/routes/v1/identity-oidc-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-oidc-auth-router.ts
@@ -1,6 +1,7 @@
import { z } from "zod";
-import { IdentityOidcAuthsSchema } from "@app/db/schemas";
+import { IdentityAuthMethod, IdentityOidcAuthsSchema } from "@app/db/schemas";
+import { logger } from "@app/lib/logger";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, OIDC_AUTH } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
@@ -92,10 +93,10 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityOidcAuth.identityId,
orgId: identity.orgId,
- authMethod: "oidc"
+ authMethod: IdentityAuthMethod.OIDC_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return {
accessToken,
@@ -210,10 +211,10 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityOidcAuth.identityId,
orgId: identityOidcAuth.orgId,
- authMethod: "oidc"
+ authMethod: IdentityAuthMethod.OIDC_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return {
identityOidcAuth
@@ -325,10 +326,10 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityOidcAuth.identityId,
orgId: identityOidcAuth.orgId,
- authMethod: "oidc"
+ authMethod: IdentityAuthMethod.OIDC_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityOidcAuth };
}
@@ -440,10 +441,10 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
properties: {
identityId: identityOidcAuth.identityId,
orgId: identityOidcAuth.orgId,
- authMethod: "oidc"
+ authMethod: IdentityAuthMethod.OIDC_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityOidcAuth };
}
diff --git a/backend/src/server/routes/v1/identity-router.ts b/backend/src/server/routes/v1/identity-router.ts
index cf050dbce4..9491451a4c 100644
--- a/backend/src/server/routes/v1/identity-router.ts
+++ b/backend/src/server/routes/v1/identity-router.ts
@@ -3,6 +3,7 @@ import { z } from "zod";
import { IdentitiesSchema, IdentityOrgMembershipsSchema, OrgMembershipRole, OrgRolesSchema } from "@app/db/schemas";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, IDENTITIES } from "@app/lib/api-docs";
+import { logger } from "@app/lib/logger";
import { buildSearchZodSchema, SearchResourceOperators } from "@app/lib/search-resource/search";
import { OrderByDirection } from "@app/lib/types";
import { CharacterType, zodValidateCharacters } from "@app/lib/validator/validate-string";
@@ -176,7 +177,7 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
hasDeleteProtection: identity.hasDeleteProtection
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identity };
}
@@ -239,7 +240,7 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
orgId: identity.orgId
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identity };
}
diff --git a/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts b/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts
index 966bbe23c8..73c23e4281 100644
--- a/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts
@@ -1,6 +1,7 @@
import { z } from "zod";
-import { IdentityTlsCertAuthsSchema } from "@app/db/schemas";
+import { IdentityAuthMethod, IdentityTlsCertAuthsSchema } from "@app/db/schemas";
+import { logger } from "@app/lib/logger";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, TLS_CERT_AUTH } from "@app/lib/api-docs";
import { getConfig } from "@app/lib/config/env";
@@ -96,10 +97,10 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
properties: {
identityId: identityTlsCertAuth.identityId,
orgId: identity.orgId,
- authMethod: "tls"
+ authMethod: IdentityAuthMethod.TLS_CERT_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return {
accessToken,
@@ -216,10 +217,10 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
properties: {
identityId: identityTlsCertAuth.identityId,
orgId: req.permission.orgId,
- authMethod: "tls"
+ authMethod: IdentityAuthMethod.TLS_CERT_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityTlsCertAuth };
}
@@ -331,10 +332,10 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
properties: {
identityId: identityTlsCertAuth.identityId,
orgId: req.permission.orgId,
- authMethod: "tls"
+ authMethod: IdentityAuthMethod.TLS_CERT_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityTlsCertAuth };
}
@@ -445,10 +446,10 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
properties: {
identityId: identityTlsCertAuth.identityId,
orgId: req.permission.orgId,
- authMethod: "tls"
+ authMethod: IdentityAuthMethod.TLS_CERT_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityTlsCertAuth };
}
diff --git a/backend/src/server/routes/v1/identity-token-auth-router.ts b/backend/src/server/routes/v1/identity-token-auth-router.ts
index 98293a6269..be202377d8 100644
--- a/backend/src/server/routes/v1/identity-token-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-token-auth-router.ts
@@ -1,6 +1,7 @@
import { z } from "zod";
-import { IdentityAccessTokensSchema, IdentityTokenAuthsSchema } from "@app/db/schemas";
+import { IdentityAccessTokensSchema, IdentityAuthMethod, IdentityTokenAuthsSchema } from "@app/db/schemas";
+import { logger } from "@app/lib/logger";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, TOKEN_AUTH } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
@@ -108,10 +109,10 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
properties: {
identityId: identityTokenAuth.identityId,
orgId: identityTokenAuth.orgId,
- authMethod: "token_auth"
+ authMethod: IdentityAuthMethod.TOKEN_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return {
identityTokenAuth
@@ -208,10 +209,10 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
properties: {
identityId: identityTokenAuth.identityId,
orgId: identityTokenAuth.orgId,
- authMethod: "token_auth"
+ authMethod: IdentityAuthMethod.TOKEN_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return {
identityTokenAuth
@@ -324,10 +325,10 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
properties: {
identityId: identityTokenAuth.identityId,
orgId: identityTokenAuth.orgId,
- authMethod: "token_auth"
+ authMethod: IdentityAuthMethod.TOKEN_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityTokenAuth };
}
@@ -401,7 +402,7 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
orgId: identity.orgId
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return {
accessToken,
@@ -678,7 +679,7 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
orgId: req.permission.orgId
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return {
message: "Successfully revoked access token"
diff --git a/backend/src/server/routes/v1/identity-universal-auth-router.ts b/backend/src/server/routes/v1/identity-universal-auth-router.ts
index f83c78540b..f45b18ed36 100644
--- a/backend/src/server/routes/v1/identity-universal-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-universal-auth-router.ts
@@ -1,6 +1,7 @@
import { z } from "zod";
-import { IdentityUaClientSecretsSchema, IdentityUniversalAuthsSchema } from "@app/db/schemas";
+import { IdentityAuthMethod, IdentityUaClientSecretsSchema, IdentityUniversalAuthsSchema } from "@app/db/schemas";
+import { logger } from "@app/lib/logger";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { ApiDocsTags, UNIVERSAL_AUTH } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
@@ -87,10 +88,10 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
properties: {
identityId: identityUa.identityId,
orgId: identity.orgId,
- authMethod: "universal_auth"
+ authMethod: IdentityAuthMethod.UNIVERSAL_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return {
accessToken,
@@ -224,10 +225,10 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
properties: {
identityId: identityUniversalAuth.identityId,
orgId: identityUniversalAuth.orgId,
- authMethod: "universal_auth"
+ authMethod: IdentityAuthMethod.UNIVERSAL_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityUniversalAuth };
}
@@ -361,10 +362,10 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
properties: {
identityId: identityUniversalAuth.identityId,
orgId: identityUniversalAuth.orgId,
- authMethod: "universal_auth"
+ authMethod: IdentityAuthMethod.UNIVERSAL_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityUniversalAuth };
}
@@ -474,10 +475,10 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
properties: {
identityId: identityUniversalAuth.identityId,
orgId: identityUniversalAuth.orgId,
- authMethod: "universal_auth"
+ authMethod: IdentityAuthMethod.UNIVERSAL_AUTH
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { identityUniversalAuth };
}
@@ -548,7 +549,7 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
orgId
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { clientSecret, clientSecretData };
}
@@ -717,7 +718,7 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
orgId: clientSecretData.orgId
}
})
- .catch(() => {});
+ .catch((error) => { logger.error(error, "Failed to send telemetry event"); });
return { clientSecretData };
}
diff --git a/backend/src/services/telemetry/telemetry-types.ts b/backend/src/services/telemetry/telemetry-types.ts
index b2bcf675de..02f2600e8c 100644
--- a/backend/src/services/telemetry/telemetry-types.ts
+++ b/backend/src/services/telemetry/telemetry-types.ts
@@ -1,3 +1,4 @@
+import { IdentityAuthMethod } from "@app/db/schemas";
import {
AcmeAccountActor,
AcmeProfileActor,
@@ -154,7 +155,7 @@ export type TMachineIdentityLoginEvent = {
properties: {
identityId: string;
orgId: string;
- authMethod: string;
+ authMethod: IdentityAuthMethod;
};
};
@@ -166,7 +167,7 @@ export type TMachineIdentityAuthMethodEvent = {
properties: {
identityId: string;
orgId: string;
- authMethod: string;
+ authMethod: IdentityAuthMethod;
};
};