🪢 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(blob): preserve GCS Details field through error wrapping (#14478)
Niklas Semmler13560fedb651
diff --git a/packages/shared/src/server/services/StorageService.ts b/packages/shared/src/server/services/StorageService.tsindex 7c541d3a5b..4c7bef0392 100644--- a/packages/shared/src/server/services/StorageService.ts+++ b/packages/shared/src/server/services/StorageService.ts@@ -103,7 +103,20 @@ function handleStorageError(err: unknown, operation: string): never {);}// For other errors, throw with the original cause preserved- throw new Error(`Failed to ${operation}`, { cause: err });+ const wrapped = new Error(`Failed to ${operation}`, { cause: err });+ // Preserve provider-specific details (e.g. GCS <Details> XML element)+ // so they surface when Winston spreads the error's enumerable properties.+ if (+ err &&+ typeof err === "object" &&+ "Details" in err &&+ typeof (err as { Details?: unknown }).Details === "string"+ ) {+ (wrapped as unknown as { Details: string }).Details = (+ err as { Details: string }+ ).Details;+ }+ throw wrapped;}function createS3RequestHandler(diff --git a/packages/shared/src/server/services/s3SigningDiagnostics.test.ts b/packages/shared/src/server/services/s3SigningDiagnostics.test.tsindex 98d08cf569..78b31119d3 100644--- a/packages/shared/src/server/services/s3SigningDiagnostics.test.ts+++ b/packages/shared/src/server/services/s3SigningDiagnostics.test.ts@@ -28,9 +28,25 @@ describe("summarizeS3Error", () => {requestId: "req-123",extendedRequestId: "ext-456",message: "The request signature we calculated",+ details: undefined,});});+ it("extracts GCS-specific Details from the XML error body", () => {+ const err = Object.assign(new Error("Invalid argument."), {+ name: "InvalidArgument",+ Code: "InvalidArgument",+ Details: "Multipart upload is not supported in Rapid storage class.",+ $fault: "client",+ $metadata: { httpStatusCode: 400 },+ });++ const summary = summarizeS3Error(err);+ expect(summary.details).toBe(+ "Multipart upload is not supported in Rapid storage class.",+ );+ });+it("never throws on non-object errors", () => {expect(summarizeS3Error("boom")).toEqual({ message: "boom" });expect(summarizeS3Error(undefined)).toEqual({ message: "undefined" });diff --git a/packages/shared/src/server/services/s3SigningDiagnostics.ts b/packages/shared/src/server/services/s3SigningDiagnostics.tsindex 485e480cc2..d17b918d1a 100644--- a/packages/shared/src/server/services/s3SigningDiagnostics.ts+++ b/packages/shared/src/server/services/s3SigningDiagnostics.ts@@ -20,6 +20,7 @@ export interface S3ErrorSummary {requestId?: string;extendedRequestId?: string;message?: string;+ details?: string;}/**@@ -35,6 +36,7 @@ export function summarizeS3Error(err: unknown): S3ErrorSummary {name?: string;message?: string;Code?: string;+ Details?: string;$fault?: string;$metadata?: {httpStatusCode?: number;@@ -50,6 +52,7 @@ export function summarizeS3Error(err: unknown): S3ErrorSummary {requestId: e.$metadata?.requestId,extendedRequestId: e.$metadata?.extendedRequestId,message: e.message,+ details: e.Details,};}diff --git a/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts b/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.tsindex c1088a2656..a611aea4fc 100644--- a/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts+++ b/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts@@ -1242,12 +1242,23 @@ function extractStorageErrorMessage(error: unknown): string {// handleStorageError wraps SDK errors via { cause: sdkError }// Unwrap to get the raw SDK message (S3/Azure/GCS)const cause = error.cause;- if (cause instanceof Error) {- return cause.message.slice(0, 1000);- }-- // Fallback: ClickHouse errors or other non-wrapped errors- return error.message.slice(0, 1000);+ const message = cause instanceof Error ? cause.message : error.message;++ // GCS returns a <Details> XML element with the real rejection reason+ // (e.g. "Multipart upload is not supported in Rapid storage class.").+ // handleStorageError preserves it as an enumerable property.+ const errorDetails = (error as unknown as { Details?: unknown }).Details;+ const causeDetails = (cause as unknown as { Details?: unknown } | undefined)+ ?.Details;+ const details =+ typeof errorDetails === "string"+ ? errorDetails+ : typeof causeDetails === "string"+ ? causeDetails+ : undefined;++ const full = details ? `${message} Details: ${details}` : message;+ return full.slice(0, 1000);}function formatErrorChain(error: unknown): string {