🪢 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
chore: remove turnstile (#10611)
Marc Klingen0c7f09842b64
diff --git a/.claude/skills/backend-dev-guidelines/resources/configuration.md b/.claude/skills/backend-dev-guidelines/resources/configuration.mdindex d62db03482..75a13ce913 100644--- a/.claude/skills/backend-dev-guidelines/resources/configuration.md+++ b/.claude/skills/backend-dev-guidelines/resources/configuration.md@@ -50,6 +50,7 @@ langfuse/Uses **t3-oss/env-nextjs** for Next.js-specific validation with server/client separation.**Key Features:**+- Separates server-side and client-side environment variables- Client variables must be prefixed with `NEXT_PUBLIC_`- Validates at build time (unless `DOCKER_BUILD=1`)@@ -77,7 +78,6 @@ export const env = createEnv({.enum(["US", "EU", "STAGING", "DEV", "HIPAA"]).optional(),NEXT_PUBLIC_SIGN_UP_DISABLED: z.enum(["true", "false"]).default("false"),- NEXT_PUBLIC_TURNSTILE_SITE_KEY: z.string().optional(),// ... client variables},@@ -85,7 +85,8 @@ export const env = createEnv({runtimeEnv: {DATABASE_URL: process.env.DATABASE_URL,NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET,- NEXT_PUBLIC_LANGFUSE_CLOUD_REGION: process.env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION,+ NEXT_PUBLIC_LANGFUSE_CLOUD_REGION:+ process.env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION,// ... must map ALL variables},@@ -122,7 +123,9 @@ import { removeEmptyEnvVariables } from "@langfuse/shared";const EnvSchema = z.object({BUILD_ID: z.string().optional(),- NODE_ENV: z.enum(["development", "test", "production"]).default("development"),+ NODE_ENV: z+ .enum(["development", "test", "production"])+ .default("development"),DATABASE_URL: z.string(),PORT: z.coerce.number().positive().max(65536).default(3030),@@ -137,12 +140,22 @@ const EnvSchema = z.object({}),// Queue concurrency settings- LANGFUSE_INGESTION_QUEUE_PROCESSING_CONCURRENCY: z.coerce.number().positive().default(20),- LANGFUSE_EVAL_EXECUTION_WORKER_CONCURRENCY: z.coerce.number().positive().default(5),+ LANGFUSE_INGESTION_QUEUE_PROCESSING_CONCURRENCY: z.coerce+ .number()+ .positive()+ .default(20),+ LANGFUSE_EVAL_EXECUTION_WORKER_CONCURRENCY: z.coerce+ .number()+ .positive()+ .default(5),// Queue consumer toggles- QUEUE_CONSUMER_INGESTION_QUEUE_IS_ENABLED: z.enum(["true", "false"]).default("true"),- QUEUE_CONSUMER_BATCH_EXPORT_QUEUE_IS_ENABLED: z.enum(["true", "false"]).default("true"),+ QUEUE_CONSUMER_INGESTION_QUEUE_IS_ENABLED: z+ .enum(["true", "false"])+ .default("true"),+ QUEUE_CONSUMER_BATCH_EXPORT_QUEUE_IS_ENABLED: z+ .enum(["true", "false"])+ .default("true"),// ... 150+ worker-specific variables});@@ -173,7 +186,9 @@ import { z } from "zod/v4";import { removeEmptyEnvVariables } from "./utils/environment";const EnvSchema = z.object({- NODE_ENV: z.enum(["development", "test", "production"]).default("development"),+ NODE_ENV: z+ .enum(["development", "test", "production"])+ .default("development"),// Redis configurationREDIS_HOST: z.string().nullish(),@@ -193,11 +208,19 @@ const EnvSchema = z.object({LANGFUSE_S3_EVENT_UPLOAD_REGION: z.string().optional(),// Logging- LANGFUSE_LOG_LEVEL: z.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),+ LANGFUSE_LOG_LEVEL: z+ .enum(["trace", "debug", "info", "warn", "error", "fatal"])+ .optional(),LANGFUSE_LOG_FORMAT: z.enum(["text", "json"]).default("text"),// Encryption- ENCRYPTION_KEY: z.string().length(64, "ENCRYPTION_KEY must be 256 bits, 64 string characters in hex format, generate via: openssl rand -hex 32").optional(),+ ENCRYPTION_KEY: z+ .string()+ .length(+ 64,+ "ENCRYPTION_KEY must be 256 bits, 64 string characters in hex format, generate via: openssl rand -hex 32",+ )+ .optional(),// ... 80+ shared variables});@@ -254,6 +277,7 @@ const licenseKey = env.LANGFUSE_EE_LICENSE_KEY;**Type:** `"US" | "EU" | "STAGING" | "DEV" | "HIPAA" | undefined`**Where Used:**+- **web/src/env.mjs** - Client-side accessible (prefixed with `NEXT_PUBLIC_`)- **ee/src/env.ts** - Enterprise features- **packages/shared/src/env.ts** - Shared logic@@ -261,13 +285,13 @@ const licenseKey = env.LANGFUSE_EE_LICENSE_KEY;**When Set:**-| Environment | Value | Purpose |-|-------------|-------|---------|-| **Developer Laptop** | `"DEV"` or `"STAGING"` | Local development against cloud infrastructure |-| **Langfuse Cloud US** | `"US"` | Production US region |-| **Langfuse Cloud EU** | `"EU"` | Production EU region |-| **Langfuse Cloud HIPAA** | `"HIPAA"` | HIPAA-compliant region |-| **OSS Self-Hosted** | `undefined` (not set) | Self-hosted deployments don't have region |+| Environment | Value | Purpose |+| ------------------------ | ---------------------- | ---------------------------------------------- |+| **Developer Laptop** | `"DEV"` or `"STAGING"` | Local development against cloud infrastructure |+| **Langfuse Cloud US** | `"US"` | Production US region |+| **Langfuse Cloud EU** | `"EU"` | Production EU region |+| **Langfuse Cloud HIPAA** | `"HIPAA"` | HIPAA-compliant region |+| **OSS Self-Hosted** | `undefined` (not set) | Self-hosted deployments don't have region |**Use Cases:**@@ -313,20 +337,22 @@ NEXT_PUBLIC_LANGFUSE_CLOUD_REGION=US**Type:** `string | undefined`**Where Used:**+- **web/src/env.mjs** - Web app EE features- **ee/src/env.ts** - EE package**When Set:**-| Deployment | Value | Features Enabled |-|------------|-------|------------------|-| **Langfuse Cloud** | Not set | Cloud features controlled by `NEXT_PUBLIC_LANGFUSE_CLOUD_REGION` |-| **OSS Self-Hosted** | Not set | Core open-source features only |-| **EE Self-Hosted** | License key string | Enterprise features enabled |+| Deployment | Value | Features Enabled |+| ------------------- | ------------------ | ---------------------------------------------------------------- |+| **Langfuse Cloud** | Not set | Cloud features controlled by `NEXT_PUBLIC_LANGFUSE_CLOUD_REGION` |+| **OSS Self-Hosted** | Not set | Core open-source features only |+| **EE Self-Hosted** | License key string | Enterprise features enabled |**Enterprise Features Controlled:**When `LANGFUSE_EE_LICENSE_KEY` is set and valid:+- SSO integrations (custom OIDC, SAML)- Advanced RBAC- Audit logging@@ -372,7 +398,7 @@ NEXT_PUBLIC_LANGFUSE_CLOUD_REGION=US```typescript// Skip validation during Docker builds-skipValidation: process.env.DOCKER_BUILD === "1"+skipValidation: process.env.DOCKER_BUILD === "1";```**Purpose:** Docker builds happen before runtime env vars are available, so validation must be skipped.@@ -382,7 +408,7 @@ skipValidation: process.env.DOCKER_BUILD === "1"```typescriptSALT: z.string({required_error: "A strong Salt is required to encrypt API keys securely.",-})+});```**Purpose:** Required for encrypting API keys in database. Must be set in production.@@ -390,7 +416,7 @@ SALT: z.string({**ENCRYPTION_KEY**```typescript-ENCRYPTION_KEY: z.string().length(64, "Must be 256 bits, 64 hex characters")+ENCRYPTION_KEY: z.string().length(64, "Must be 256 bits, 64 hex characters");```**Purpose:** Optional 256-bit key for encrypting sensitive database fields.@@ -425,14 +451,14 @@ import { env } from "./env";import { env } from "@langfuse/shared/src/env";```-### 3. Client Variables Must Start with NEXT_PUBLIC_+### 3. Client Variables Must Start with NEXT*PUBLIC*```typescript// ❌ Won't work in browser-API_KEY: z.string() // in server config+API_KEY: z.string(); // in server config// ✅ Accessible in browser-NEXT_PUBLIC_API_KEY: z.string() // in client config+NEXT_PUBLIC_API_KEY: z.string(); // in client config```### 4. Provide Sensible Defaults for Development@@ -447,7 +473,7 @@ REDIS_PORT: z.coerce.number().positive().default(6379),```typescript// .env files are always strings-PORT: z.coerce.number() // Converts "3000" to 3000+PORT: z.coerce.number(); // Converts "3000" to 3000```### 6. Transform Complex Values@@ -523,6 +549,7 @@ langfuse/```**DO NOT commit:**+- `.env`- `.env.local`- `.env.production`diff --git a/.env.prod.example b/.env.prod.exampleindex c4aac65394..a93b3229f3 100644--- a/.env.prod.example+++ b/.env.prod.example@@ -262,10 +262,6 @@ LANGFUSE_ENABLE_BLOB_STORAGE_FILE_LOG=true# SENTRY_CSP_REPORT_URI=-# Cloudflare Turnstile-# NEXT_PUBLIC_TURNSTILE_SITE_KEY=-# TURNSTILE_SECRET_KEY=-# Demo project that users can use to try the platform# NEXT_PUBLIC_DEMO_ORG_ID=# NEXT_PUBLIC_DEMO_PROJECT_ID=diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 493eda907d..021225f14d 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -394,9 +394,6 @@ importers:'@lezer/highlight':specifier: ^1.2.1version: 1.2.1- '@marsidev/react-turnstile':- specifier: ^0.5.4'@modelcontextprotocol/sdk':specifier: ^1.20.2version: 1.22.0(@cfworker/[email protected])@@ -3147,12 +3144,6 @@ packages:'@marijn/[email protected]':resolution: {integrity: sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==}- '@marsidev/[email protected]':- resolution: {integrity: sha512-cloUDkEcJm+G7p3J8DwPtRNNB2GZqVi/nlIbgu9o3VzNyV5K/bWcSfOyWouRiR3umAQZmsFpR3OFYa4mCmy4AQ==}- peerDependencies:- react: '>=16.8.0'- react-dom: '>=16.8.0'-'@mermaid-js/[email protected]':resolution: {integrity: sha512-a0swOS6PByXKi0dZnLQQIhbtUEu7ubc6bojmIqXqvUPq7mIJukCNEvVBTv6IAbuEWqB3Ti8QntupoGdz3ej+kg==}engines: {node: ^18.19 || >=20.0}@@ -17485,11 +17476,6 @@ snapshots:'@marijn/[email protected]': {}- dependencies:- react: 19.2.0- react-dom: 19.2.0([email protected])-'@mermaid-js/[email protected](@babel/[email protected])(@babel/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])':dependencies:'@mermaid-js/mermaid-zenuml': 0.2.2(@babel/[email protected])(@babel/[email protected])(@types/[email protected])([email protected])([email protected])([email protected])diff --git a/web/Dockerfile b/web/Dockerfileindex ab20864b3c..75ef94fc68 100644--- a/web/Dockerfile+++ b/web/Dockerfile@@ -42,8 +42,6 @@ ARG NEXT_PUBLIC_DEMO_PROJECT_IDENV NEXT_PUBLIC_DEMO_PROJECT_ID=$NEXT_PUBLIC_DEMO_PROJECT_IDARG NEXT_PUBLIC_SIGN_UP_DISABLEDENV NEXT_PUBLIC_SIGN_UP_DISABLED=$NEXT_PUBLIC_SIGN_UP_DISABLED-ARG NEXT_PUBLIC_TURNSTILE_SITE_KEY-ENV NEXT_PUBLIC_TURNSTILE_SITE_KEY=$NEXT_PUBLIC_TURNSTILE_SITE_KEYARG NEXT_PUBLIC_POSTHOG_KEYENV NEXT_PUBLIC_POSTHOG_KEY=$NEXT_PUBLIC_POSTHOG_KEYARG NEXT_PUBLIC_POSTHOG_HOSTdiff --git a/web/package.json b/web/package.jsonindex 4120f62d0a..d50e016ba3 100644--- a/web/package.json+++ b/web/package.json@@ -42,7 +42,6 @@"@langfuse/ee": "workspace:*","@langfuse/shared": "workspace:*","@lezer/highlight": "^1.2.1",- "@marsidev/react-turnstile": "^0.5.4","@modelcontextprotocol/sdk": "^1.20.2","@mui/material": "^7.3.1","@mui/x-tree-view": "^8.17.0",diff --git a/web/src/env.mjs b/web/src/env.mjsindex cdb5fcca59..82081daa6f 100644--- a/web/src/env.mjs+++ b/web/src/env.mjs@@ -194,8 +194,6 @@ export const env = createEnv({EMAIL_FROM_ADDRESS: z.string().optional(),SMTP_CONNECTION_URL: z.string().optional(),- TURNSTILE_SECRET_KEY: z.string().optional(),-// OtelOTEL_EXPORTER_OTLP_ENDPOINT: z.string().default("http://localhost:4318"),OTEL_SERVICE_NAME: z.string().default("web"),@@ -359,7 +357,6 @@ export const env = createEnv({NEXT_PUBLIC_DEMO_PROJECT_ID: z.string().optional(),NEXT_PUBLIC_DEMO_ORG_ID: z.string().optional(),NEXT_PUBLIC_SIGN_UP_DISABLED: z.enum(["true", "false"]).default("false"),- NEXT_PUBLIC_TURNSTILE_SITE_KEY: z.string().optional(),NEXT_PUBLIC_POSTHOG_KEY: z.string().optional(),NEXT_PUBLIC_POSTHOG_HOST: z.string().optional(),NEXT_PUBLIC_PLAIN_APP_ID: z.string().optional(),@@ -566,8 +563,6 @@ export const env = createEnv({LANGFUSE_S3_MEDIA_UPLOAD_SSE_KMS_KEY_ID:process.env.LANGFUSE_S3_MEDIA_UPLOAD_SSE_KMS_KEY_ID,// Worker- TURNSTILE_SECRET_KEY: process.env.TURNSTILE_SECRET_KEY,- NEXT_PUBLIC_TURNSTILE_SITE_KEY: process.env.NEXT_PUBLIC_TURNSTILE_SITE_KEY,NEXT_PUBLIC_POSTHOG_KEY: process.env.NEXT_PUBLIC_POSTHOG_KEY,NEXT_PUBLIC_POSTHOG_HOST: process.env.NEXT_PUBLIC_POSTHOG_HOST,// Otherdiff --git a/web/src/pages/auth/sign-in.tsx b/web/src/pages/auth/sign-in.tsxindex 26cd089c8d..fc746aefaf 100644--- a/web/src/pages/auth/sign-in.tsx+++ b/web/src/pages/auth/sign-in.tsx@@ -30,11 +30,9 @@ import Link from "next/link";import { useState, useEffect } from "react";import { useForm } from "react-hook-form";import * as z from "zod/v4";-import { Divider } from "@tremor/react";import { CloudPrivacyNotice } from "@/src/features/auth/components/AuthCloudPrivacyNotice";import { CloudRegionSwitch } from "@/src/features/auth/components/AuthCloudRegionSwitch";import { PasswordInput } from "@/src/components/ui/password-input";-import { Turnstile } from "@marsidev/react-turnstile";import { isAnySsoConfigured } from "@/src/ee/features/multi-tenant-sso/utils";import { Code, Key } from "lucide-react";import { useRouter } from "next/router";@@ -552,11 +550,6 @@ export default function SignIn({const capture = usePostHogClientCapture();const { isLangfuseCloud } = useLangfuseCloudRegion();- const [turnstileToken, setTurnstileToken] = useState<string>();- // Used to refresh turnstile as the token can only be used once- const [turnstileCData, setTurnstileCData] = useState<string>(- new Date().getTime().toString(),- );// Count available auth methods to determine if we should show "Last used" badgeconst availableProviders = Object.entries(authProviders).filter(@@ -596,7 +589,6 @@ export default function SignIn({password: values.password,callbackUrl: targetPath ?? "/",redirect: false,- turnstileToken,});if (result === undefined) {setCredentialsFormError("An unexpected error occurred.");@@ -617,12 +609,6 @@ export default function SignIn({captureException(error);console.error(error);setCredentialsFormError("An unexpected error occurred.");- } finally {- // Refresh turnstile as the token can only be used once- if (env.NEXT_PUBLIC_TURNSTILE_SITE_KEY && turnstileToken) {- setTurnstileCData(new Date().getTime().toString());- setTurnstileToken(undefined);- }}}@@ -797,9 +783,6 @@ export default function SignIn({: continueLoading}disabled={- (env.NEXT_PUBLIC_TURNSTILE_SITE_KEY !== undefined &&- showPasswordStep &&- turnstileToken === undefined) ||credentialsForm.watch("email") === "" ||(showPasswordStep &&credentialsForm.watch("password") === "")@@ -838,24 +821,6 @@ export default function SignIn({onProviderSelect={setLastUsedAuthMethod}/></div>- {- // Turnstile exists copy-paste also on sign-up.tsx- env.NEXT_PUBLIC_TURNSTILE_SITE_KEY !== undefined && (- <>- <Divider className="text-muted-foreground" />- <Turnstile- siteKey={env.NEXT_PUBLIC_TURNSTILE_SITE_KEY}- options={{- theme: "light",- action: "sign-in",- cData: turnstileCData,- }}- className="mx-auto"- onSuccess={setTurnstileToken}- />- </>- )- }{!signUpDisabled &&env.NEXT_PUBLIC_SIGN_UP_DISABLED !== "true" &&diff --git a/web/src/pages/auth/sign-up.tsx b/web/src/pages/auth/sign-up.tsxindex 2543c8f82b..0d293f3f72 100644--- a/web/src/pages/auth/sign-up.tsx+++ b/web/src/pages/auth/sign-up.tsx@@ -26,8 +26,6 @@ import {type PageProps,} from "@/src/pages/auth/sign-in";import { PasswordInput } from "@/src/components/ui/password-input";-import { Divider } from "@tremor/react";-import { Turnstile } from "@marsidev/react-turnstile";import { useLangfuseCloudRegion } from "@/src/features/organizations/hooks";import { useRouter } from "next/router";import { getSafeRedirectPath } from "@/src/utils/redirect";@@ -57,12 +55,6 @@ export default function SignIn({? getSafeRedirectPath(queryTargetPath): undefined;- const [turnstileToken, setTurnstileToken] = useState<string>();- // Used to refresh turnstile as the token can only be used once- const [turnstileCData, setTurnstileCData] = useState<string>(- new Date().getTime().toString(),- );-const [formError, setFormError] = useState<string | null>(null);// Two-step login flow: ask for email first, detect SSO, then either redirect to SSO or reveal password field.@@ -188,16 +180,9 @@ export default function SignIn({: isLangfuseCloud && region !== "DEV"? `${env.NEXT_PUBLIC_BASE_PATH ?? ""}/onboarding`: `${env.NEXT_PUBLIC_BASE_PATH ?? ""}/`,- turnstileToken,});} catch (err) {setFormError("An error occurred. Please try again.");-- // Refresh turnstile as the token can only be used once- if (env.NEXT_PUBLIC_TURNSTILE_SITE_KEY && turnstileToken) {- setTurnstileCData(new Date().getTime().toString());- setTurnstileToken(undefined);- }}}@@ -292,12 +277,9 @@ export default function SignIn({: continueLoading}disabled={- (env.NEXT_PUBLIC_TURNSTILE_SITE_KEY !== undefined &&- showPasswordStep &&- turnstileToken === undefined) ||- (showPasswordStep+ showPasswordStep? false // Form validation handles this via handleSubmit- : form.watch("email") === "")+ : form.watch("email") === ""}data-testid="submit-email-password-sign-up-form">@@ -316,27 +298,6 @@ export default function SignIn({lastUsedMethod={lastUsedAuthMethod}onProviderSelect={setLastUsedAuthMethod}/>- {- // Turnstile exists copy-paste also on sign-up.tsx- // Only show turnstile when we are on the password step (final submission)- // if SSO is enabled. If SSO is disabled, showPasswordStep is true, so it shows.- env.NEXT_PUBLIC_TURNSTILE_SITE_KEY !== undefined &&- showPasswordStep && (- <>- <Divider className="text-muted-foreground" />- <Turnstile- siteKey={env.NEXT_PUBLIC_TURNSTILE_SITE_KEY}- options={{- theme: "light",- action: "sign-in",- cData: turnstileCData,- }}- className="mx-auto"- onSuccess={setTurnstileToken}- />- </>- )- }<p className="mt-10 text-center text-sm text-muted-foreground">Already have an account?{" "}<Linkdiff --git a/web/src/server/auth.ts b/web/src/server/auth.tsindex 8ae6fb7cc8..e72a84f315 100644--- a/web/src/server/auth.ts+++ b/web/src/server/auth.ts@@ -91,11 +91,6 @@ const staticProviders: Provider[] = [placeholder: "[email protected]",},password: { label: "Password", type: "password" },- turnstileToken: {- label: "Turnstile Token (Captcha)",- type: "text",- value: "dummy",- },},async authorize(credentials, _req) {if (!credentials) throw new Error("No credentials");@@ -104,23 +99,6 @@ const staticProviders: Provider[] = ["Sign in with email and password is disabled for this instance. Please use SSO.",);- if (env.TURNSTILE_SECRET_KEY && env.NEXT_PUBLIC_TURNSTILE_SITE_KEY) {- const res = await fetch(- "https://challenges.cloudflare.com/turnstile/v0/siteverify",- {- method: "POST",- body: `secret=${encodeURIComponent(env.TURNSTILE_SECRET_KEY)}&response=${encodeURIComponent(credentials.turnstileToken)}`,- headers: {- "content-type": "application/x-www-form-urlencoded",- },- },- );- const data = await res.json();- if (data.success === false) {- throw new Error("Invalid captcha token");- }- }-const blockedDomains = getSSOBlockedDomains();const domain = credentials.email.split("@")[1]?.toLowerCase();if (domain && blockedDomains.includes(domain)) {