Skip to content

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

Update identity-project-service.ts

Daniel Hougaard8bb68f98893d
diff --git a/backend/src/services/identity-project/identity-project-service.ts b/backend/src/services/identity-project/identity-project-service.ts
index 8fea80e311..14df0cd4ab 100644
--- a/backend/src/services/identity-project/identity-project-service.ts
+++ b/backend/src/services/identity-project/identity-project-service.ts
@@ -380,6 +380,12 @@ export const identityProjectServiceFactory = ({
}: TGetProjectIdentityByMembershipIdDTO) => {
const membership = await identityProjectDAL.findOne({ id: identityMembershipId });
+ if (!membership) {
+ throw new NotFoundError({
+ message: `Project membership with ID '${identityMembershipId}' not found`
+ });
+ }
+
const { permission } = await permissionService.getProjectPermission({
actor,
actorId,
@@ -389,12 +395,6 @@ export const identityProjectServiceFactory = ({
actionProjectType: ActionProjectType.Any
});
- if (!membership) {
- throw new NotFoundError({
- message: `Project membership with ID '${identityMembershipId}' not found`
- });
- }
-
ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionIdentityActions.Read,
subject(ProjectPermissionSub.Identity, { identityId: membership.identityId })