🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(account): Skip stripe cancellation during organization deletion in self-hosted environments (#9799)
Michael Fröhlich2171218bd85f
diff --git a/web/src/features/organizations/server/organizationRouter.ts b/web/src/features/organizations/server/organizationRouter.tsindex 69a0e5b405..76df83f37d 100644--- a/web/src/features/organizations/server/organizationRouter.ts+++ b/web/src/features/organizations/server/organizationRouter.ts@@ -14,6 +14,7 @@ import { TRPCError } from "@trpc/server";import { ApiAuthService } from "@/src/features/public-api/server/apiAuth";import { redis } from "@langfuse/shared/src/server";import { createBillingServiceFromContext } from "@/src/ee/features/billing/server/stripeBillingService";+import { isCloudBillingEnabled } from "@/src/ee/features/billing/utils/isCloudBilling";import { env } from "@/src/env.mjs";@@ -138,17 +139,19 @@ export const organizationsRouter = createTRPCRouter({}// Attempt to cancel Stripe subscription immediately (Cloud only) before deleting org- try {- const stripeBillingService = createBillingServiceFromContext(ctx);- await stripeBillingService.cancelImmediatelyAndInvoice(input.orgId);- } catch (e) {- // If billing cancellation fails for reasons other than no subscription, abort deletion- throw new TRPCError({- code: "INTERNAL_SERVER_ERROR",- message:- "Failed to cancel Stripe subscription prior to organization deletion",- cause: e as Error,- });+ if (isCloudBillingEnabled()) {+ try {+ const stripeBillingService = createBillingServiceFromContext(ctx);+ await stripeBillingService.cancelImmediatelyAndInvoice(input.orgId);+ } catch (e) {+ // If billing cancellation fails for reasons other than no subscription, abort deletion+ throw new TRPCError({+ code: "INTERNAL_SERVER_ERROR",+ message:+ "Failed to cancel Stripe subscription prior to organization deletion",+ cause: e as Error,+ });+ }}const organization = await ctx.prisma.organization.delete({