Skip to content

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

fix: allow deleting a sub-org from its own settings page

Devin AI85066bc0f93c
diff --git a/backend/src/services/org/org-service.ts b/backend/src/services/org/org-service.ts
index cc68d8cdbf..214e8ab255 100644
--- a/backend/src/services/org/org-service.ts
+++ b/backend/src/services/org/org-service.ts
@@ -843,7 +843,8 @@ export const orgServiceFactory = ({
const decodedToken = crypto.jwt().verify(authToken, cfg.AUTH_SECRET) as AuthModeJwtTokenPayload;
if (!decodedToken.authMethod) throw new UnauthorizedError({ name: "Auth method not found on existing token" });
- const org = await requestMemoize(requestMemoKeys.orgFindOrgById(orgId), () => orgDAL.findOrgById(orgId));
+ const org = await requestMemoize(requestMemoKeys.orgFindById(orgId), () => orgDAL.findById(orgId));
+ if (!org) throw new NotFoundError({ message: `Organization with ID '${orgId}' not found` });
// if root org null = this is a root org then cancel the subscription.
if (!org.rootOrgId) {
await licenseService.cancelOrgSubscription(orgId);