🪢 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: filter signup body for sentry (#543)
Max Deichmann85f76167079d
diff --git a/next.config.mjs b/next.config.mjsindex d212151227..f69ad66fc3 100644--- a/next.config.mjs+++ b/next.config.mjs@@ -27,17 +27,23 @@ const nextConfig = {if (env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION !== undefined)return [{- source: '/api/auth/session',+ source: "/api/auth/session",headers: [- { key: "Access-Control-Allow-Origin", value: "https://langfuse.com" },+ {+ key: "Access-Control-Allow-Origin",+ value: "https://langfuse.com",+ },{ key: "Access-Control-Allow-Credentials", value: "true" },{ key: "Access-Control-Allow-Methods", value: "GET,POST" },- { key: "Access-Control-Allow-Headers", value: "Content-Type, Authorization" },- ]- }- ]+ {+ key: "Access-Control-Allow-Headers",+ value: "Content-Type, Authorization",+ },+ ],+ },+ ];- return []+ return [];},// webassembly support for @dqbd/tiktokendiff --git a/sentry.server.config.ts b/sentry.server.config.tsindex 7d81efa490..36442c2599 100644--- a/sentry.server.config.ts+++ b/sentry.server.config.ts@@ -1,9 +1,12 @@import { prisma } from "@/src/server/db";+import { jsonSchema } from "@/src/utils/zod";import * as Sentry from "@sentry/nextjs";import { ProfilingIntegration } from "@sentry/profiling-node";+import type { TransactionEvent } from "@sentry/types";if (process.env.NEXT_PUBLIC_SENTRY_DSN)Sentry.init({+ // debug: true,dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,// Set tracesSampleRate to 1.0 to capture 100%@@ -18,6 +21,35 @@ if (process.env.NEXT_PUBLIC_SENTRY_DSN)new Sentry.Integrations.Prisma({ client: prisma }),],+ // filter out passwords from the signup request body+ // transaction events are sentry transactions which include logs and spans.+ beforeSendTransaction(transaction: TransactionEvent) {+ if (+ transaction.request &&+ typeof transaction.request.data === "string" &&+ transaction.request.url &&+ transaction.request.url.includes("api/auth/signup")+ ) {+ const jsonBody = jsonSchema.safeParse(transaction.request.data);++ if (+ jsonBody.success &&+ typeof jsonBody.data === "object" &&+ "data" in jsonBody.data+ ) {+ delete jsonBody.data.password;+ transaction.request.data = JSON.stringify(jsonBody.data);+ transaction.request.data = JSON.stringify(jsonBody);+ } else {+ console.log("Signup: Non Json Request body");+ }++ return transaction;+ }++ return transaction;+ },+// ...// Note: if you want to override the automatic release value, do not set a