Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore: do not send auth errors to DLQ in bull (#4062)

Steffen Schmitz09b916aac9aa
diff --git a/packages/shared/src/server/ingestion/legacy/index.ts b/packages/shared/src/server/ingestion/legacy/index.ts
index 10a3df3070..8769b4b2ce 100644
--- a/packages/shared/src/server/ingestion/legacy/index.ts
+++ b/packages/shared/src/server/ingestion/legacy/index.ts
@@ -77,7 +77,7 @@ export const handleBatch = async (
// Decide how to handle the error: rethrow, continue, or push an error object to results
// For example, push an error object:
errors.push({
- error: error,
+ error,
id: singleEvent.id,
type: singleEvent.type,
});
diff --git a/worker/src/queues/legacyIngestionQueue.ts b/worker/src/queues/legacyIngestionQueue.ts
index 21d342349a..3e7e0da754 100644
--- a/worker/src/queues/legacyIngestionQueue.ts
+++ b/worker/src/queues/legacyIngestionQueue.ts
@@ -15,6 +15,7 @@ import {
} from "@langfuse/shared/src/server";
import { tokenCount } from "../features/tokenisation/usage";
import { env } from "../env";
+import { ForbiddenError, UnauthorizedError } from "@langfuse/shared";
let s3StorageServiceClient: S3StorageService;
@@ -93,9 +94,18 @@ export const legacyIngestionQueueProcessor: Processor = async (
tokenCount,
);
- if (result.errors.length > 0) {
+ // Do not retry events via bullmq for auth errors
+ const processingErrors = result.errors.filter(
+ (e) =>
+ !(e.error instanceof UnauthorizedError) &&
+ !(e.error instanceof ForbiddenError),
+ );
+ if (processingErrors.length > 0) {
// Raise errors if any are returned to retry the batch via bullmq
- throw new Error(`Failed to process ${result.errors.length} events`);
+ logger.error(`Failed to process ${processingErrors.length} events`, {
+ errors: processingErrors,
+ });
+ throw new Error(`Failed to process ${processingErrors.length} events`);
}
// send out REDIS requests to worker for all trace types