🪢 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(web-callouts): remove env var gate (#14286)
Nimar482d6b9daf4b
diff --git a/.env.dev.example b/.env.dev.exampleindex da622a98c8..245b58b629 100644--- a/.env.dev.example+++ b/.env.dev.example@@ -73,7 +73,6 @@ NEXT_PUBLIC_LANGFUSE_CLOUD_REGION="DEV"# Langfuse experimental featuresLANGFUSE_ENABLE_EXPERIMENTAL_FEATURES="false"-LANGFUSE_ENABLE_WEB_CALLOUTS="true"# Salt for API key hashingSALT="salt"diff --git a/.env.prod.example b/.env.prod.exampleindex 27d6415cdd..045704cd7f 100644--- a/.env.prod.example+++ b/.env.prod.example@@ -54,7 +54,6 @@ OTEL_SERVICE_NAME="langfuse"# Enable experimental features, optional# LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES=false-# LANGFUSE_ENABLE_WEB_CALLOUTS=false# Auth, optional configuration# AUTH_DOMAINS_WITH_SSO_ENFORCEMENT=domain1.com,domain2.comdiff --git a/web/src/__tests__/server/web-callouts-trpc.servertest.ts b/web/src/__tests__/server/web-callouts-trpc.servertest.tsindex 17a6d4d732..e241af9129 100644--- a/web/src/__tests__/server/web-callouts-trpc.servertest.ts+++ b/web/src/__tests__/server/web-callouts-trpc.servertest.ts@@ -319,11 +319,9 @@ const mockSuccessfulTargetValidation = ({describe("webCallouts router", () => {const originalCloudRegion = env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION;const originalNodeEnv = env.NODE_ENV;- const originalWebCalloutsEnabled = env.LANGFUSE_ENABLE_WEB_CALLOUTS;beforeEach(() => {(env as any).NEXT_PUBLIC_LANGFUSE_CLOUD_REGION = undefined;- (env as any).LANGFUSE_ENABLE_WEB_CALLOUTS = "true";(enforceWebCalloutRateLimit as Mock).mockResolvedValue(undefined);(recordWebCalloutInvokeMetric as Mock).mockReturnValue(undefined);(withWebCalloutInFlightLimit as Mock).mockImplementation(@@ -344,7 +342,6 @@ describe("webCallouts router", () => {afterEach(() => {(env as any).NODE_ENV = originalNodeEnv;- (env as any).LANGFUSE_ENABLE_WEB_CALLOUTS = originalWebCalloutsEnabled;vi.useRealTimers();vi.clearAllMocks();});@@ -391,40 +388,6 @@ describe("webCallouts router", () => {expect(enabled).not.toHaveProperty("requestHeaderKeys");});- it("hides metadata and blocks backend work when disabled by environment", async () => {- const { caller, projectId } = await prepare();-- await createEndpoint(caller, projectId);- vi.clearAllMocks();- (env as any).LANGFUSE_ENABLE_WEB_CALLOUTS = "false";-- await expect(- caller.webCallouts.availability({ projectId }),- ).resolves.toEqual({ enabled: false });- await expect(caller.webCallouts.enabled({ projectId })).resolves.toEqual({- enabled: false,- id: null,- name: null,- toastMessage: null,- });- await expect(caller.webCallouts.all({ projectId })).rejects.toMatchObject({- code: "NOT_FOUND",- message: "Web callouts are not enabled.",- });- await expect(- caller.webCallouts.invoke({- projectId,- traceId: "trace-1",- observationId: null,- sessionId: null,- }),- ).rejects.toMatchObject({- code: "NOT_FOUND",- message: "Web callouts are not enabled.",- });- expect(fetchWithSecureRedirects).not.toHaveBeenCalled();- });-it("allows callout URLs on custom ports", async () => {const { caller, projectId } = await prepare();diff --git a/web/src/env.mjs b/web/src/env.mjsindex b388644a3b..9e9d6b9b59 100644--- a/web/src/env.mjs+++ b/web/src/env.mjs@@ -78,7 +78,6 @@ export const env = createEnv({LANGFUSE_ADMIN_ACCESS_WEBHOOK: z.url().optional(),// Add `.min(1) on ID and SECRET if you want to make sure they're not emptyLANGFUSE_ENABLE_EXPERIMENTAL_FEATURES: z.enum(["true", "false"]).optional(),- LANGFUSE_ENABLE_WEB_CALLOUTS: z.enum(["true", "false"]).default("false"),SALT: z.string({error: (issue) =>issue.input === undefined@@ -522,7 +521,6 @@ export const env = createEnv({NEXT_PUBLIC_SIGN_UP_DISABLED: process.env.NEXT_PUBLIC_SIGN_UP_DISABLED,LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES:process.env.LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES,- LANGFUSE_ENABLE_WEB_CALLOUTS: process.env.LANGFUSE_ENABLE_WEB_CALLOUTS,AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY,LANGFUSE_AWS_BEDROCK_REGION: process.env.LANGFUSE_AWS_BEDROCK_REGION,diff --git a/web/src/features/web-callouts/components/WebCalloutSettingsPage.tsx b/web/src/features/web-callouts/components/WebCalloutSettingsPage.tsxindex 9e1cc5d852..551e0d19b0 100644--- a/web/src/features/web-callouts/components/WebCalloutSettingsPage.tsx+++ b/web/src/features/web-callouts/components/WebCalloutSettingsPage.tsx@@ -694,15 +694,6 @@ export function WebCalloutIntegrationCard(props: {projectId: string;hasAccess: boolean;}) {- const availability = api.webCallouts.availability.useQuery(- { projectId: props.projectId },- { staleTime: 60_000 },- );-- if (availability.data?.enabled !== true) {- return null;- }-return (<Card className="p-3"><div className="mb-4 flex items-center gap-2">diff --git a/web/src/features/web-callouts/server/featureFlag.ts b/web/src/features/web-callouts/server/featureFlag.tsdeleted file mode 100644index edb5722790..0000000000--- a/web/src/features/web-callouts/server/featureFlag.ts+++ /dev/null@@ -1,15 +0,0 @@-import { TRPCError } from "@trpc/server";--import { env } from "@/src/env.mjs";--export const isWebCalloutsEnabled = () =>- env.LANGFUSE_ENABLE_WEB_CALLOUTS === "true";--export const throwIfWebCalloutsDisabled = () => {- if (!isWebCalloutsEnabled()) {- throw new TRPCError({- code: "NOT_FOUND",- message: "Web callouts are not enabled.",- });- }-};diff --git a/web/src/features/web-callouts/server/router.ts b/web/src/features/web-callouts/server/router.tsindex 61ba583958..898ca371a7 100644--- a/web/src/features/web-callouts/server/router.ts+++ b/web/src/features/web-callouts/server/router.ts@@ -13,28 +13,12 @@ import {toSafeWebCalloutEndpoint,upsertWebCalloutEndpoint,} from "@/src/features/web-callouts/server/service";-import {- isWebCalloutsEnabled,- throwIfWebCalloutsDisabled,-} from "@/src/features/web-callouts/server/featureFlag";import {createTRPCRouter,protectedProjectProcedure,} from "@/src/server/api/trpc";export const webCalloutsRouter = createTRPCRouter({- availability: protectedProjectProcedure- .input(z.object({ projectId: z.string() }))- .query(({ input, ctx }) => {- throwIfNoProjectAccess({- session: ctx.session,- projectId: input.projectId,- scope: "project:read",- });-- return { enabled: isWebCalloutsEnabled() };- }),-all: protectedProjectProcedure.input(z.object({ projectId: z.string() })).query(async ({ input, ctx }) => {@@ -43,7 +27,6 @@ export const webCalloutsRouter = createTRPCRouter({projectId: input.projectId,scope: "integrations:CRUD",});- throwIfWebCalloutsDisabled();const endpoints = await ctx.prisma.webCalloutEndpoint.findMany({where: { projectId: input.projectId },@@ -62,10 +45,6 @@ export const webCalloutsRouter = createTRPCRouter({scope: "project:read",});- if (!isWebCalloutsEnabled()) {- return toEnabledWebCallout(null);- }-const endpoint = await ctx.prisma.webCalloutEndpoint.findFirst({where: { projectId: input.projectId, enabled: true },orderBy: { createdAt: "asc" },@@ -82,7 +61,6 @@ export const webCalloutsRouter = createTRPCRouter({projectId: input.projectId,scope: "integrations:CRUD",});- throwIfWebCalloutsDisabled();const before = input.id? await ctx.prisma.webCalloutEndpoint@@ -123,7 +101,6 @@ export const webCalloutsRouter = createTRPCRouter({projectId: input.projectId,scope: "integrations:CRUD",});- throwIfWebCalloutsDisabled();const endpoint = await ctx.prisma.webCalloutEndpoint.findFirst({where: {@@ -165,7 +142,6 @@ export const webCalloutsRouter = createTRPCRouter({projectId: input.projectId,scope: "project:read",});- throwIfWebCalloutsDisabled();return invokeWebCalloutEndpoint({prisma: ctx.prisma,diff --git a/web/src/pages/project/[projectId]/settings/integrations/web-callouts.tsx b/web/src/pages/project/[projectId]/settings/integrations/web-callouts.tsxindex 01976dd12d..e317da3bf4 100644--- a/web/src/pages/project/[projectId]/settings/integrations/web-callouts.tsx+++ b/web/src/pages/project/[projectId]/settings/integrations/web-callouts.tsx@@ -1,27 +1,15 @@-import { ErrorPage } from "@/src/components/error-page";import ContainerPage from "@/src/components/layouts/container-page";import { WebCalloutSettingsPage } from "@/src/features/web-callouts/components/WebCalloutSettingsPage";-import { api } from "@/src/utils/api";import { useRouter } from "next/router";export default function WebCalloutsSettings() {const router = useRouter();const projectId = router.query.projectId as string | undefined;- const availability = api.webCallouts.availability.useQuery(- { projectId: projectId ?? "" },- { enabled: Boolean(projectId), staleTime: 60_000 },- );- if (!projectId || availability.isPending) {+ if (!projectId) {return null;}- if (availability.data?.enabled !== true) {- return (- <ErrorPage title="Page not found" message="This page does not exist." />- );- }-return (<ContainerPageheaderProps={{