🪢 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: capture errors in sentry (#2424)
Max Deichmanne2bcc6bf4e11
diff --git a/web/src/pages/api/public/ingestion.ts b/web/src/pages/api/public/ingestion.tsindex 406e992be4..ff1552b348 100644--- a/web/src/pages/api/public/ingestion.ts+++ b/web/src/pages/api/public/ingestion.ts@@ -136,6 +136,8 @@ export default async function handler(} catch (error: unknown) {console.error("error handling ingestion event", error);+ Sentry.captureException(error);+if (error instanceof BaseError) {return res.status(error.httpCode).json({error: error.name,diff --git a/web/src/pages/api/public/prompts.ts b/web/src/pages/api/public/prompts.tsindex f651a68e2f..f7a27ca95a 100644--- a/web/src/pages/api/public/prompts.ts+++ b/web/src/pages/api/public/prompts.ts@@ -17,6 +17,7 @@ import {ForbiddenError,} from "@langfuse/shared";import { PRODUCTION_LABEL } from "@/src/features/prompts/constants";+import * as Sentry from "@sentry/node";export default async function handler(req: NextApiRequest,@@ -83,6 +84,8 @@ export default async function handler(} catch (error: unknown) {console.error(error);+ Sentry.captureException(error);+if (error instanceof BaseError) {return res.status(error.httpCode).json({error: error.name,diff --git a/web/src/server/utils/withMiddlewares.ts b/web/src/server/utils/withMiddlewares.tsindex 22d646d697..6d8c821a4a 100644--- a/web/src/server/utils/withMiddlewares.ts+++ b/web/src/server/utils/withMiddlewares.ts@@ -3,6 +3,7 @@ import { cors, runMiddleware } from "@/src/features/public-api/server/cors";import { type NextApiRequest, type NextApiResponse } from "next";import { z } from "zod";import { BaseError, MethodNotAllowedError } from "@langfuse/shared";+import * as Sentry from "@sentry/node";const httpMethods = ["GET", "POST", "PUT", "DELETE"] as const;type HttpMethod = (typeof httpMethods)[number];@@ -39,6 +40,8 @@ export function withMiddlewares(handlers: Handlers) {} catch (error) {console.error(error);+ Sentry.captureException(error);+if (error instanceof BaseError) {return res.status(error.httpCode).json({message: error.message,