Skip to content

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

feat: add OCI Object Storage Native SDK integration with IAM auth options (#12379)

Sanjeeva kumar Kalvafe76bd280f41
diff --git a/.env.dev-oci.example b/.env.dev-oci.example
new file mode 100644
index 0000000000..b17a271f7a
--- /dev/null
+++ b/.env.dev-oci.example
@@ -0,0 +1,196 @@
+#####################################################################
+# .env (template) — OCI Object Storage / S3-compatible configuration
+#
+# IMPORTANT SECURITY NOTES (Oracle best practice)
+# - Prefer OCI-native auth (Instance Principal / Workload Identity / Resource Principal)
+# over static keys.
+# - If you must use static keys, store them in a secure secret manager
+# (e.g., Kubernetes Secret / OCI Vault) and inject at runtime.
+# - Rotate/revoke any credentials that were previously shared or committed.
+#####################################################################
+
+
+#####################################################################
+# 1) Storage/Auth category (CHOOSE ONE)
+#
+# The app can read/write/download to/from an OCI object store for:
+# - Batch exports (exports/)
+# - Media uploads (media/)
+# - Event uploads (events/)
+#
+# Pick exactly ONE auth mechanism for OCI-native object storage by setting:
+# LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE=true
+# LANGFUSE_OCI_AUTH_TYPE=<one of the values below>
+#
+# Supported values:
+# workload_identity | instance_principal | resource_principal | oci_profile | session_token
+#####################################################################
+
+
+#####################################################################
+# Category A — OCI Object Storage with INSTANCE PRINCIPAL (recommended on OCI Compute)
+# Use when:
+# - Running on OCI Compute with IAM set up (dynamic group + policies)
+#
+# Set:
+# LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE=true
+# LANGFUSE_OCI_AUTH_TYPE=instance_principal
+#
+# NOTE: Do NOT set *_ACCESS_KEY_ID / *_SECRET_ACCESS_KEY in this category.
+#####################################################################
+
+
+#####################################################################
+# Category B — OCI Object Storage with WORKLOAD IDENTITY (common on OKE)
+# Use when:
+# - Running on OKE with OCI Workload Identity configured
+#
+# Set:
+# LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE=true
+# LANGFUSE_OCI_AUTH_TYPE=workload_identity
+#
+# Optional (only if your environment requires additional CA trust):
+# NODE_EXTRA_CA_CERTS=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
+#
+# NOTE: Do NOT set *_ACCESS_KEY_ID / *_SECRET_ACCESS_KEY in this category.
+#####################################################################
+
+
+#####################################################################
+# Category C — OCI Object Storage with RESOURCE PRINCIPAL (common for OCI services)
+# Use when:
+# - Running inside an OCI service/runtime that injects Resource Principal env vars
+# (e.g., certain managed services / automation contexts)
+#
+# Set:
+# LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE=true
+# LANGFUSE_OCI_AUTH_TYPE=resource_principal
+#
+# NOTE: Do NOT set *_ACCESS_KEY_ID / *_SECRET_ACCESS_KEY in this category.
+#####################################################################
+
+
+#####################################################################
+# Category D — OCI Object Storage with OCI CONFIG PROFILE (developer local)
+# Use when:
+# - You have an OCI config file locally or mounted in the runtime
+# - You want to use a named profile
+#
+# Set:
+# LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE=true
+# LANGFUSE_OCI_AUTH_TYPE=oci_profile
+# OCI_CONFIG_FILE=/path/to/oci/config
+# OCI_CONFIG_PROFILE=DEFAULT
+#
+# NOTE: Avoid adding config files into images; mount/inject securely.
+#####################################################################
+
+
+#####################################################################
+# Category E — OCI Object Storage with SESSION TOKEN (short-lived user auth)
+# Use when:
+# - You use OCI CLI session authentication (short-lived token flow)
+# - USE oci session authenticate
+# - Appropriate for interactive/dev use; less common for long-running services
+#
+# Set:
+# LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE=true
+# LANGFUSE_OCI_AUTH_TYPE=session_token
+# OCI_CONFIG_FILE=/path/to/oci/config
+# OCI_CONFIG_PROFILE=DEFAULT
+#####################################################################
+
+
+#####################################################################
+# Other possible setup — Non-OCI provider (AWS S3 / GCP / Azure / MinIO / etc.)
+# Use when:
+# - Your object storage is NOT OCI Object Storage
+#
+# Set:
+# LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE=false
+#
+# Then configure endpoints/regions/credentials for your provider.
+#####################################################################
+
+
+
+#####################################################################
+# 2) Feature: S3 Batch Export
+#
+# Required (when enabled):
+# - *_BUCKET, *_REGION, *_ENDPOINT, *_PREFIX
+# Optional:
+# - *_EXTERNAL_ENDPOINT
+# - *_FORCE_PATH_STYLE=true (needed for many S3-compatible providers like MinIO)
+#
+# Credentials:
+# - Set *_ACCESS_KEY_ID/_SECRET_ACCESS_KEY ONLY for static-key auth
+# (non-OCI S3-compatible providers)
+#####################################################################
+LANGFUSE_S3_BATCH_EXPORT_ENABLED=true
+LANGFUSE_S3_BATCH_EXPORT_BUCKET=langfuse-bucket
+LANGFUSE_S3_BATCH_EXPORT_PREFIX=exports/
+
+# OCI example region/endpoint:
+LANGFUSE_S3_BATCH_EXPORT_REGION=us-chicago-1
+LANGFUSE_S3_BATCH_EXPORT_ENDPOINT=https://objectstorage.us-chicago-1.oraclecloud.com
+LANGFUSE_S3_BATCH_EXPORT_EXTERNAL_ENDPOINT=https://objectstorage.us-chicago-1.oraclecloud.com
+
+# MinIO / S3-compat setting (safe to keep true for many S3-compatible endpoints)
+LANGFUSE_S3_BATCH_EXPORT_FORCE_PATH_STYLE=true
+
+# Static-key auth (non-OCI). Leave blank/commented for OCI-native auth types above.
+LANGFUSE_S3_BATCH_EXPORT_ACCESS_KEY_ID=__REPLACE_ME__
+LANGFUSE_S3_BATCH_EXPORT_SECRET_ACCESS_KEY=__REPLACE_ME__
+
+
+
+#####################################################################
+# 3) Feature: S3 Media Upload
+#####################################################################
+LANGFUSE_S3_MEDIA_UPLOAD_BUCKET=langfuse-bucket
+LANGFUSE_S3_MEDIA_UPLOAD_PREFIX=media/
+LANGFUSE_S3_MEDIA_UPLOAD_REGION=us-chicago-1
+LANGFUSE_S3_MEDIA_UPLOAD_ENDPOINT=https://objectstorage.us-chicago-1.oraclecloud.com
+LANGFUSE_S3_MEDIA_UPLOAD_FORCE_PATH_STYLE=true
+
+# Static-key auth (non-OCI). Leave blank/commented for OCI-native auth types above.
+LANGFUSE_S3_MEDIA_UPLOAD_ACCESS_KEY_ID=__REPLACE_ME__
+LANGFUSE_S3_MEDIA_UPLOAD_SECRET_ACCESS_KEY=__REPLACE_ME__
+
+
+
+#####################################################################
+# 4) Feature: S3 Event Upload (optional)
+#####################################################################
+LANGFUSE_S3_EVENT_UPLOAD_BUCKET=langfuse-bucket
+LANGFUSE_S3_EVENT_UPLOAD_PREFIX=events/
+LANGFUSE_S3_EVENT_UPLOAD_REGION=us-chicago-1
+LANGFUSE_S3_EVENT_UPLOAD_ENDPOINT=https://objectstorage.us-chicago-1.oraclecloud.com
+LANGFUSE_S3_EVENT_UPLOAD_FORCE_PATH_STYLE=true
+
+# Static-key auth (non-OCI). Leave blank/commented for OCI-native auth types above.
+LANGFUSE_S3_EVENT_UPLOAD_ACCESS_KEY_ID=__REPLACE_ME__
+LANGFUSE_S3_EVENT_UPLOAD_SECRET_ACCESS_KEY=__REPLACE_ME__
+
+
+
+#####################################################################
+# 5) OCI native auth configuration (used by oci_profile / session_token)
+#####################################################################
+# Only required when LANGFUSE_OCI_AUTH_TYPE is: oci_profile OR session_token
+OCI_CONFIG_FILE=__REPLACE_ME__/config
+OCI_CONFIG_PROFILE=DEFAULT
+
+
+
+#####################################################################
+# 6) Troubleshooting notes (comments only)
+#
+# - If you see TLS errors to the endpoint in Kubernetes/OKE, set NODE_EXTRA_CA_CERTS to the
+# correct CA bundle path for your environment.
+# - If using MinIO or certain S3-compatible providers and you get bucket addressing errors,
+# set *_FORCE_PATH_STYLE=true.
+# - If downloads work inside the cluster but not externally, configure
+# LANGFUSE_S3_BATCH_EXPORT_EXTERNAL_ENDPOINT to a publicly reachable endpoint/DNS.
+#####################################################################
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 43790554f1..2d3bd9c395 100644
--- a/.gitignore
+++ b/.gitignore
@@ -47,6 +47,7 @@ yarn-error.log*
!.env.dev-redis-cluster.example
!.env.prod.example
!.env.test.example
+!.env.dev-oci.example
# vercel
.vercel
diff --git a/docker-compose.yml b/docker-compose.yml
index 4879e0d2a7..4264dc8e5c 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -31,6 +31,8 @@ services:
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:-clickhouse} # CHANGEME
CLICKHOUSE_CLUSTER_ENABLED: ${CLICKHOUSE_CLUSTER_ENABLED:-false}
LANGFUSE_USE_AZURE_BLOB: ${LANGFUSE_USE_AZURE_BLOB:-false}
+ LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE: ${LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE:-false}
+ LANGFUSE_OCI_AUTH_TYPE: ${LANGFUSE_OCI_AUTH_TYPE:-workload_identity}
LANGFUSE_S3_EVENT_UPLOAD_BUCKET: ${LANGFUSE_S3_EVENT_UPLOAD_BUCKET:-langfuse}
LANGFUSE_S3_EVENT_UPLOAD_REGION: ${LANGFUSE_S3_EVENT_UPLOAD_REGION:-auto}
LANGFUSE_S3_EVENT_UPLOAD_ACCESS_KEY_ID: ${LANGFUSE_S3_EVENT_UPLOAD_ACCESS_KEY_ID:-minio}
diff --git a/packages/shared/package.json b/packages/shared/package.json
index ec1fdf957e..b4ce6a55ed 100644
--- a/packages/shared/package.json
+++ b/packages/shared/package.json
@@ -114,6 +114,8 @@
"lossless-json": "^4.1.1",
"next-auth": "^4.24.13",
"nodemailer": "^7.0.11",
+ "oci-objectstorage": "^2.125.0",
+ "oci-common": "^2.125.0",
"safe-regex2": "^5.0.0",
"undici": "^7.24.6",
"uuid": "^9.0.1",
diff --git a/packages/shared/src/env.ts b/packages/shared/src/env.ts
index 12c0f5a247..d90959955c 100644
--- a/packages/shared/src/env.ts
+++ b/packages/shared/src/env.ts
@@ -179,6 +179,21 @@ const EnvSchema = z.object({
.default("true"),
LANGFUSE_USE_GOOGLE_CLOUD_STORAGE: z.enum(["true", "false"]).default("false"),
LANGFUSE_GOOGLE_CLOUD_STORAGE_CREDENTIALS: z.string().optional(),
+ LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE: z
+ .enum(["true", "false"])
+ .default("false"),
+ LANGFUSE_OCI_AUTH_TYPE: z
+ .enum([
+ "workload_identity",
+ "instance_principal",
+ "resource_principal",
+ "oci_profile",
+ "session_token",
+ ])
+ .optional(),
+ LANGFUSE_OCI_CONFIG_FILE: z.string().optional(),
+ LANGFUSE_OCI_CONFIG_PROFILE: z.string().optional(),
+ NODE_EXTRA_CA_CERTS: z.string().optional(),
STRIPE_SECRET_KEY: z.string().optional(),
LANGFUSE_ENABLE_BLOB_STORAGE_FILE_LOG: z
diff --git a/packages/shared/src/server/services/StorageService.ts b/packages/shared/src/server/services/StorageService.ts
index 760e1e0f81..7775f581aa 100644
--- a/packages/shared/src/server/services/StorageService.ts
+++ b/packages/shared/src/server/services/StorageService.ts
@@ -22,6 +22,10 @@ import { backOff } from "exponential-backoff";
import { ServiceUnavailableError } from "../../errors";
import { BufferedStreamUploader } from "./BufferedStreamUploader";
import { S3ChunkedUploadStrategy } from "./S3ChunkedUploadStrategy";
+import * as objectstorage from "oci-objectstorage";
+import * as common from "oci-common";
+import { UploadManager as OciUploadManager } from "oci-objectstorage";
+import { URL } from "node:url";
export interface S3SseConfig {
serverSideEncryption?: string;
@@ -127,6 +131,7 @@ export class StorageServiceFactory {
* @param params.region - Region in which the bucket resides
* @param params.forcePathStyle - Add bucket name into the path instead of the domain name. Mainly used for MinIO.
* @param params.useAzureBlob - Use Azure Blob Storage instead of S3
+ * @param params.useOCIObjectStorage - Use OCI Object Storage instead of S3
* @param params.useGoogleCloudStorage - Use Google Cloud Storage instead of S3
* @param params.googleCloudCredentials - Google Cloud Storage credentials JSON string or path to credentials file
* @param params.awsSse - Server-side encryption method (e.g., "aws:kms")
@@ -142,6 +147,7 @@ export class StorageServiceFactory {
forcePathStyle: boolean;
useAzureBlob?: boolean;
useGoogleCloudStorage?: boolean;
+ useOCIObjectStorage?: boolean;
googleCloudCredentials?: string;
awsSse: string | undefined;
awsSseKmsKeyId: string | undefined;
@@ -167,6 +173,13 @@ export class StorageServiceFactory {
};
return new GoogleCloudStorageService(googleParams);
}
+ if (
+ params.useOCIObjectStorage !== undefined
+ ? params.useOCIObjectStorage
+ : env.LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE === "true"
+ ) {
+ return new OCIObjectStorageService(params);
+ }
return new S3StorageService(params);
}
}
@@ -1009,3 +1022,492 @@ class GoogleCloudStorageService implements StorageService {
}
}
}
+
+class OCIObjectStorageService implements StorageService {
+ private client?: objectstorage.ObjectStorageClient;
+ private clientInit: Promise<void>;
+ private bucketName: string;
+ private externalEndpoint?: string;
+ private namespaceName: string = "";
+
+ constructor(params: {
+ bucketName: string;
+ endpoint: string | undefined;
+ externalEndpoint?: string | undefined;
+ region: string | undefined;
+ }) {
+ this.bucketName = params.bucketName;
+ this.externalEndpoint = params.externalEndpoint;
+ this.clientInit = this.initClient(params);
+ }
+
+ private async initClient(params: { endpoint?: string; region?: string }) {
+ let provider: common.AuthenticationDetailsProvider;
+ switch (env.LANGFUSE_OCI_AUTH_TYPE) {
+ case "workload_identity": {
+ provider =
+ new common.OkeWorkloadIdentityAuthenticationDetailsProvider.OkeWorkloadIdentityAuthenticationDetailsProviderBuilder().build();
+
+ break;
+ }
+
+ case "instance_principal": {
+ provider =
+ await new common.InstancePrincipalsAuthenticationDetailsProviderBuilder().build();
+
+ break;
+ }
+
+ case "resource_principal": {
+ provider =
+ common.ResourcePrincipalAuthenticationDetailsProvider.builder();
+
+ break;
+ }
+
+ case "oci_profile": {
+ provider = new common.ConfigFileAuthenticationDetailsProvider(
+ env.LANGFUSE_OCI_CONFIG_FILE,
+ env.LANGFUSE_OCI_CONFIG_PROFILE,
+ );
+
+ break;
+ }
+
+ case "session_token": {
+ provider = new common.SessionAuthDetailProvider(
+ env.LANGFUSE_OCI_CONFIG_FILE,
+ env.LANGFUSE_OCI_CONFIG_PROFILE,
+ );
+
+ break;
+ }
+
+ default:
+ throw new Error(
+ "OCI auth not configured: set LANGFUSE_OCI_AUTH_TYPE to " +
+ "'workload_identity' | 'instance_principal' | 'resource_principal' | 'oci_profile' | 'session_token'",
+ );
+ }
+
+ this.client = new objectstorage.ObjectStorageClient({
+ authenticationDetailsProvider: provider,
+ });
+
+ const regionId = params.region?.trim();
+ if (regionId) this.client.region = common.Region.fromRegionId(regionId);
+ const endpoint = params.endpoint?.trim();
+ if (endpoint) this.client.endpoint = endpoint;
+ }
+
+ private async ensureClient() {
+ await this.clientInit;
+ if (!this.client)
+ throw new Error("OCI ObjectStorage client failed to initialize");
+ return this.client;
+ }
+
+ private async ensureNamespace(): Promise<string> {
+ if (this.namespaceName) return this.namespaceName;
+ const client = await this.ensureClient();
+ const nsResp = await client.getNamespace({});
+ this.namespaceName = nsResp.value ?? "";
+ return this.namespaceName;
+ }
+
+ private async getClientAndNamespace(): Promise<{
+ client: objectstorage.ObjectStorageClient;
+ namespaceName: string;
+ }> {
+ const client = await this.ensureClient();
+ const namespaceName = await this.ensureNamespace(); // uses the same client init + cached namespace
+ return { client, namespaceName };
+ }
+
+ private async streamToString(
+ readable: any, // could be many shapes, so use `any`
+ ): Promise<string> {
+ if (!readable) return "";
+
+ // Helper: convert many chunk shapes to Buffer
+ const toBuffer = (chunk: any): Buffer => {
+ if (Buffer.isBuffer(chunk)) return chunk;
+ if (typeof chunk === "string") return Buffer.from(chunk, "utf8");
+ if (chunk instanceof ArrayBuffer) return Buffer.from(chunk);
+ // TypedArray / DataView
+ if (ArrayBuffer.isView(chunk)) {
+ return Buffer.from(
+ (chunk as Uint8Array).buffer,
+ (chunk as any).byteOffset ?? 0,
+ (chunk as any).byteLength ?? undefined,
+ );
+ }
+ // Fallback: try Buffer.from (may throw)
+ return Buffer.from(chunk);
+ };
+
+ // 1) Node.js Readable (EventEmitter style)
+ if (
+ typeof readable.on === "function" &&
+ typeof readable.read !== "undefined"
+ ) {
+ return await new Promise<string>((resolve, reject) => {
+ const chunks: Buffer[] = [];
+ readable.on("data", (chunk: any) => {
+ try {
+ chunks.push(toBuffer(chunk));
+ } catch (_err) {
+ // if conversion fails, push as Buffer of stringified chunk
+ chunks.push(Buffer.from(String(chunk)));
+ }
+ });
+ readable.on("error", (err: any) => reject(err));
+ readable.on("end", () => {
+ resolve(Buffer.concat(chunks).toString("utf8"));
+ });
+ });
+ }
+
+ // 2) WHATWG ReadableStream (browser / some fetch-like APIs)
+ if (typeof readable.getReader === "function") {
+ const reader = readable.getReader();
+ const chunks: Buffer[] = [];
+ try {
+ while (true) {
+ const { done, value } = await reader.read();
+ if (done) break;
+ chunks.push(toBuffer(value));
+ }
+ return Buffer.concat(chunks).toString("utf8");
+ } finally {
+ // safe to close reader if available
+ try {
+ if (reader.releaseLock) reader.releaseLock();
+ } catch (_err) {
+ // intentionally ignore releaseLock errors
+ }
+ }
+ }
+
+ // 3) Buffer / Uint8Array / ArrayBuffer direct
+ if (Buffer.isBuffer(readable)) return readable.toString("utf8");
+ if (readable instanceof Uint8Array)
+ return Buffer.from(readable).toString("utf8");
+ if (readable instanceof ArrayBuffer)
+ return Buffer.from(readable).toString("utf8");
+
+ // 4) Blob (browser)
+ if (typeof Blob !== "undefined" && readable instanceof Blob) {
+ const ab = await readable.arrayBuffer();
+ return Buffer.from(ab).toString("utf8");
+ }
+
+ // 5) Async iterable (some stream implementations)
+ if (typeof readable[Symbol.asyncIterator] === "function") {
+ const chunks: Buffer[] = [];
+ for await (const chunk of readable) {
+ chunks.push(toBuffer(chunk));
+ }
+ return Buffer.concat(chunks).toString("utf8");
+ }
+
+ // 6) Synchronous iterable
+ if (typeof readable[Symbol.iterator] === "function") {
+ const chunks: Buffer[] = [];
+ for (const chunk of readable) {
+ chunks.push(toBuffer(chunk));
+ }
+ return Buffer.concat(chunks).toString("utf8");
+ }
+
+ // 7) Fallback: try string conversion
+ try {
+ return String(readable);
+ } catch (_err) {
+ // If all else fails, throw a helpful error
+ throw new TypeError("Unsupported body type passed to streamToString");
+ }
+ }
+ public async uploadFile({
+ fileName,
+ fileType,
+ data,
+ partSize,
+ queueSize,
+ }: UploadFile): Promise<void> {
+ try {
+ const { client, namespaceName } = await this.getClientAndNamespace();
+ const uploadManager = new OciUploadManager(client, {
+ partSize: partSize ?? 20 * 1024 * 1024,
+ maxConcurrentUploads: queueSize ?? 5,
+ });
+
+ // UploadManager in the OCI SDK expects content shaped as one of:
+ // { blob }, { filePath }, or { stream }.
+ // To work reliably in Node, always provide { stream }.
+ const stream =
+ typeof data === "string"
+ ? Readable.from([data])
+ : data instanceof Readable
+ ? data
+ : Buffer.isBuffer(data as any)
+ ? Readable.from([data as any])
+ : Readable.from([String(data)]);
+
+ const contentLength =
+ typeof data === "string"
+ ? Buffer.byteLength(data)
+ : Buffer.isBuffer(data as any)
+ ? (data as any).byteLength
+ : undefined;
+
+ await uploadManager.upload({
+ requestDetails: {
+ namespaceName,
+ bucketName: this.bucketName,
+ objectName: fileName,
+ contentType: fileType,
+ ...(contentLength ? { contentLength } : {}),
+ },
+ content: { stream },
+ });
+
+ return;
+ } catch (err) {
+ logger.error(
+ `Failed to upload file to OCI Object Storage ${fileName}`,
+ err,
+ );
+ handleStorageError(err, "upload file to OCI Object Storage ");
+ }
+ }
+
+ public async uploadFileBuffered({
+ fileName,
+ fileType,
+ data,
+ partSizeBytes,
+ }: UploadFileBuffered): Promise<void> {
+ await this.uploadFile({
+ fileName,
+ fileType,
+ data,
+ partSize: partSizeBytes,
+ });
+ }
+
+ public async uploadWithSignedUrl({
+ fileName,
+ fileType,
+ data,
+ expiresInSeconds,
+ partSize,
+ queueSize,
+ }: UploadWithSignedUrl): Promise<{ signedUrl: string }> {
+ try {
+ await this.uploadFile({ fileName, data, fileType, partSize, queueSize });
+
+ const signedUrl = await this.getSignedUrl(fileName, expiresInSeconds);
+
+ return { signedUrl };
+ } catch (err) {
+ logger.error(
+ `Failed to upload file to OCI Object Storage ${fileName}`,
+ err,
+ );
+ handleStorageError(
+ err,
+ "upload file to OCI Object Storage or generate signed URL",
+ );
+ }
+ }
+
+ public async uploadJson(path: string, body: Record<string, unknown>[]) {
+ try {
+ const { client, namespaceName } = await this.getClientAndNamespace();
+ const jsonString = JSON.stringify(body);
+ const req: objectstorage.requests.PutObjectRequest = {
+ namespaceName,
+ bucketName: this.bucketName,
+ objectName: path,
+ contentLength: Buffer.byteLength(jsonString),
+ putObjectBody: Readable.from([jsonString]),
+ contentType: "application/json",
+ };
+ await client.putObject(req);
+ } catch (err) {
+ logger.error(`Failed to upload JSON to OCI Object Storage ${path}`, err);
+ handleStorageError(err, "upload JSON to OCI Object Storage ");
+ }
+ }
+
+ public async download(path: string): Promise<string> {
+ try {
+ const { client, namespaceName } = await this.getClientAndNamespace();
+ const req: objectstorage.requests.GetObjectRequest = {
+ namespaceName,
+ bucketName: this.bucketName,
+ objectName: path,
+ };
+ const response = await client.getObject(req);
+ const bodyStream = (response as any).value as
+ | NodeJS.ReadableStream
+ | undefined;
+ return await this.streamToString(bodyStream);
+ } catch (err) {
+ logger.error(
+ `Failed to download file from OCI Object Storage ${path}`,
+ err,
+ );
+ handleStorageError(err, "download file from OCI Object Storage ");
+ }
+ }
+
+ public async listFiles(
+ prefix: string,
+ ): Promise<{ file: string; createdAt: Date }[]> {
+ try {
+ const { client, namespaceName } = await this.getClientAndNamespace();
+ const req: objectstorage.requests.ListObjectsRequest = {
+ namespaceName,
+ bucketName: this.bucketName,
+ prefix,
+ };
+ const resp = await client.listObjects(req);
+ const objects = ((resp as any).listObjects?.objects ?? []) as Array<{
+ name?: string;
+ timeCreated?: Date | string;
+ }>;
+ return (
+ objects.flatMap((obj) =>
+ obj.name
+ ? [
+ {
+ file: obj.name,
+ createdAt: obj.timeCreated
+ ? new Date(obj.timeCreated as any)
+ : new Date(),
+ },
+ ]
+ : [],
+ ) ?? []
+ );
+ } catch (err) {
+ logger.error(
+ `Failed to list files from OCI Object Storage ${prefix}`,
+ err,
+ );
+ handleStorageError(err, "list files from OCI Object Storage ");
+ }
+ }
+
+ public async getSignedUrl(
+ fileName: string,
+ ttlSeconds: number,
+ asAttachment: boolean = true,
+ ): Promise<string> {
+ try {
+ const { client, namespaceName } = await this.getClientAndNamespace();
+ const expiresOn = new Date(Date.now() + ttlSeconds * 1000);
+ const req: objectstorage.requests.CreatePreauthenticatedRequestRequest = {
+ namespaceName,
+ bucketName: this.bucketName,
+ createPreauthenticatedRequestDetails: {
+ name: `read-${fileName}-${Date.now()}`,
+ accessType: "ObjectRead" as any,
+ objectName: fileName,
+ timeExpires: expiresOn as any,
+ } as any,
+ };
+ const resp = await client.createPreauthenticatedRequest(req);
+ const accessUri = (resp.preauthenticatedRequest as any)
+ .accessUri as string;
+ const base = this.externalEndpoint ?? client.endpoint;
+
+ if (!base) {
+ throw new Error(
+ "Cannot build PAR URL: no externalEndpoint configured and client.endpoint is empty",
+ );
+ }
+ const baseUrl = new URL(base);
+ const parUrl = new URL(accessUri, baseUrl);
+ if (asAttachment) {
+ parUrl.searchParams.set("download", "1");
+ }
+ const url = parUrl.toString();
+ return url;
+ } catch (err) {
+ logger.error(
+ `Failed to generate presigned URL (PAR) for OCI Object Storage ${fileName}`,
+ err,
+ );
+ handleStorageError(err, "generate signed URL for OCI Object Storage ");
+ }
+ }
+
+ public async deleteFiles(paths: string[]): Promise<void> {
+ try {
+ const { client, namespaceName } = await this.getClientAndNamespace();
+ for (const p of paths) {
+ const req: objectstorage.requests.DeleteObjectRequest = {
+ namespaceName,
+ bucketName: this.bucketName,
+ objectName: p,
+ } as any;
+ await client.deleteObject(req as any);
+ }
+ } catch (err) {
+ logger.error(`Failed to delete files from OCI Object Storage `, {
+ error: err,
+ files: paths,
+ });
+ handleStorageError(err, "delete files from OCI Object Storage ");
+ }
+ }
+
+ public async getSignedUploadUrl(params: {
+ path: string;
+ ttlSeconds: number;
+ sha256Hash: string;
+ contentType: string;
+ contentLength: number;
+ }): Promise<string> {
+ const { path, ttlSeconds } = params;
+ try {
+ const { client, namespaceName } = await this.getClientAndNamespace();
+ const expiresOn = new Date(Date.now() + ttlSeconds * 1000);
+ const req: objectstorage.requests.CreatePreauthenticatedRequestRequest = {
+ namespaceName,
+ bucketName: this.bucketName,
+ createPreauthenticatedRequestDetails: {
+ name: `write-${path}-${Date.now()}`,
+ accessType: "ObjectWrite" as any,
+ objectName: path,
+ timeExpires: expiresOn as any,
+ } as any,
+ };
+ const resp = await client.createPreauthenticatedRequest(req);
+ const accessUri = (resp.preauthenticatedRequest as any)
+ .accessUri as string;
+ const base = this.externalEndpoint ?? client.endpoint;
+
+ if (!base) {
+ throw new Error(
+ "Cannot build PAR URL: no externalEndpoint configured and client.endpoint is empty",
+ );
+ }
+ const baseUrl = new URL(base);
+ let url = new URL(accessUri, baseUrl).toString();
+ return url;
+ } catch (err) {
+ logger.error(
+ `Failed to generate presigned upload URL (PAR) for OCI Object Storage ${path}`,
+ err,
+ );
+ handleStorageError(
+ err,
+ "generate presigned upload URL for OCI Object Storage ",
+ );
+ }
+ }
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 21a0bec60c..3bd75d2637 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -247,6 +247,12 @@ importers:
nodemailer:
specifier: ^7.0.11
version: 7.0.11
+ oci-common:
+ specifier: ^2.125.0
+ version: 2.127.0
+ oci-objectstorage:
+ specifier: ^2.125.0
+ version: 2.127.0
react:
specifier: ~19.2.4
version: 19.2.4
@@ -5600,6 +5606,9 @@ packages:
resolution: {integrity: sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-DaZNUvLDCAnCTjgwxgiL1eQdxIKEpNLOlTNtAgnZc50bG2copGhRrFN9/PxPBuJe+tZVLCbQ7ls0xveXVRPkvw==}
+
resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==}
@@ -5624,6 +5633,12 @@ packages:
resolution: {integrity: sha512-asx5hIG9Qmf/1oStypjanR7iKTv0gXQ1Ov/jfrX6kS/EO0OFni8orbmGCn0672NHR3kXHwpAwR+B368ZGN/2rA==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-b0jGiOgHtZ2jqdPgPnP6WLCXZk1T8p06A/vPGzUvxpFGgKMbjXJDjC5m52ErqBnIuWZFgGoIJyRdeG5AyreJjA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-oBnY3csYnXfqZXDRBJwP1nDDJCW/+VMJ88UHT4DCy0deSXpJIQvMCwYlnmdW4M+u7PiSfQc44LmiFcUbJ8hLEw==}
+
resolution: {integrity: sha512-HMwFiRujE5PjrgwHQ25+bsLJgowjGjm5Z8FVSf0N6PwgJrwxH0QxzHYDcKsTfV3wva0vzrpqMTJS2jXPr5BMEQ==}
@@ -5651,6 +5666,9 @@ packages:
resolution: {integrity: sha512-E+U4RzR2dKrx+u3N4DlsmLaDC6mMZOM/TPROxA0UAPiTgI0y4CEFBmZE+coGWTjakDriRsXG368lNk1u9Q0a2g==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-9TMnd8AWRVtnZMqBbbzceQoJdafErgUViogFaQ3eetsbeLtiFFZ695mepNaLtlfJi4uRP3GmHfe3CJ2DZKaxYA==}
+
resolution: {integrity: sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==}
@@ -5710,6 +5728,9 @@ packages:
resolution: {integrity: sha512-UE7oxhQLLd9gub6JKIAhDq06T0F6FnztwMNRvYgjeQSBeMc1ZG/tA47EwfduvkuQS8apbkM/lpLpWsaCeYsXVg==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-cru1waDhHZnZuB18E6Dgf2UXf8U93mdOEDcKYe5jTri+fpucidSs7DLmGICpLxN+95aYkwtgeyny9fBFzQVdmA==}
+
resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==}
@@ -6315,6 +6336,13 @@ packages:
resolution: {integrity: sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==}
engines: {node: '>=8'}
+ resolution: {integrity: sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==}
+
+ resolution: {integrity: sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==}
+ engines: {node: '>=0.8'}
+
resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==}
engines: {node: '>=12'}
@@ -6350,6 +6378,9 @@ packages:
resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==}
engines: {node: '>= 0.4'}
+ resolution: {integrity: sha512-d1W2aNSYcz/sxYO4pMGX9vq65qOTu0P800epMud+6cYYX0QcT7zyqcxec3VWzpgvdXo57UWmVbZpLMjX2m1I7Q==}
+
resolution: {integrity: sha512-byD6KPdvo72y/wj2T/4zGEvvlis+PsZsn/yPS3pEO+sFpcrqRpX/TJCxvVaEsNeMrfQbCr7w163YqoD9IYwHXw==}
engines: {node: '>=4'}
@@ -6416,6 +6447,9 @@ packages:
resolution: {integrity: sha512-VoMINM2rqJwJgfdHq6RiUudKt2BV+FY5ZFezP/ypmwayk68+NzzAQy4XXLlqsGD4MCzq3DrmNFD/uUmBJuGoXw==}
engines: {node: '>=10.0.0'}
+ resolution: {integrity: sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==}
+
resolution: {integrity: sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ==}
@@ -6747,6 +6781,9 @@ packages:
resolution: {integrity: sha512-OP35aUorbU3Zvlx7pjsFdu1rGNnD4pgw/CWoYzRY3t2EzoVT7shKHY1dlAy3f41cGIO7ZDPQimhGFTlEYkG/Hw==}
+ resolution: {integrity: sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==}
+
resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==}
engines: {node: '>= 0.10'}
@@ -6846,6 +6883,10 @@ packages:
resolution: {integrity: sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==}
+ resolution: {integrity: sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==}
+ engines: {node: '>=0.10'}
+
resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==}
engines: {node: '>= 12'}
@@ -7105,6 +7146,9 @@ packages:
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
+ resolution: {integrity: sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==}
+
resolution: {integrity: sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==}
@@ -7207,6 +7251,9 @@ packages:
resolution: {integrity: sha512-/jhoOj/Fx+A+IIyDNOvO3TItGmlMKhtX8ISAHKE90c4b/k1tqaqEZ+uUqfpU8DMnW5cgNJv606zS55jGvza0Xw==}
+ resolution: {integrity: sha512-aRVgGdnmW2OiySVPUC9e6m+plolMAJKjZnQlCwNSuK5yQ0JN61DZSO1X1Ufd1foqWRAlig0rhduTCHe7sVtK5Q==}
+
resolution: {integrity: sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==}
engines: {node: '>=18'}
@@ -7498,6 +7545,10 @@ packages:
resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==}
+ resolution: {integrity: sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==}
+ engines: {'0': node >=0.6.0}
+
resolution: {integrity: sha512-h5+1OzzfCC3Ef7VbtKdcv7zsstUQwUDlYpUTvjeUsJAssPgLn7QzbboPtL5ro04Mq0rPOsMzl7q5hIbRs2wD1A==}
engines: {node: '>=8.0.0'}
@@ -7766,6 +7817,9 @@ packages:
resolution: {integrity: sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==}
engines: {node: '>= 14'}
+ resolution: {integrity: sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==}
+
resolution: {integrity: sha512-L5bGsVkxJbJgdnwyuheIunkGatUF/zssUoxxjACCseZYAVbaqdh9Tsmmlkl8vYan09H7sbvKt4pS8GqKLBrEzA==}
hasBin: true
@@ -7935,6 +7989,10 @@ packages:
resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==}
engines: {node: '>= 14'}
+ resolution: {integrity: sha512-Y29YKEc8MQsjch/VzkUVJ+2MXd9WcR42fK5u36CZf4G8bXw2DXMTWuESiB0R6m59JAWxlPPw5/Fri/t/AyyueA==}
+ engines: {node: '>=0.10'}
+
resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==}
engines: {node: '>= 6'}
@@ -8259,6 +8317,9 @@ packages:
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
+ resolution: {integrity: sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==}
+
resolution: {integrity: sha512-3YZcUUR2Wt1WsapF+S/WiA2WmlW0cWAoPccMqne7AxEBhCdFeTPjfv/Axb8V2gyCgY3nRw+ksZ3xSUX+R47iAg==}
engines: {node: ^18.17 || >=20.6.1}
@@ -8504,6 +8565,9 @@ packages:
resolution: {integrity: sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==}
hasBin: true
+ resolution: {integrity: sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==}
+
resolution: {integrity: sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==}
@@ -8555,6 +8619,9 @@ packages:
resolution: {integrity: sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==}
+ resolution: {integrity: sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==}
+
resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==}
@@ -8579,6 +8646,14 @@ packages:
resolution: {integrity: sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==}
engines: {node: '>=12', npm: '>=6'}
+ resolution: {integrity: sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==}
+ engines: {node: '>=0.6.0'}
+
+ resolution: {integrity: sha512-77DN1YurYgh+7FPCTJ2CQ6hVDHgIWiHxm4Y5/mAdnpETKYagX22pVWMz4xfKF5fcpNfMaztgVj+/B1bt2k23Eg==}
+ deprecated: jsSHA versions < 3.0.0 will no longer receive feature updates
+
resolution: {integrity: sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==}
engines: {node: '>=4.0'}
@@ -9426,6 +9501,15 @@ packages:
resolution: {integrity: sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==}
+ resolution: {integrity: sha512-cBvGpJoJ2j238RcbkAk/7178HKQnqc1l4KzB4ft7pA6Ua4mML7Zkn2z5dYfEMimGghNjj99jbAmoXI2VD+d+ow==}
+
+ resolution: {integrity: sha512-1IhzFKPgrSGVIKIsHjYK4lD2TIG6mNP1US/G5wcY5SfS2r+O1tmdly4ichiXGb2HjdKj4nxK7UIvYcrcMexU6w==}
+
+ resolution: {integrity: sha512-BTUM/p/ZriIvsMYeoRj+Wzu8ZM76AK0jCaU1T8AAKNDjWGNzIJ9eYQhTGT6hsD2uKTkV69hFnsv8bspKDelCMg==}
+
resolution: {integrity: sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==}
@@ -9481,6 +9565,10 @@ packages:
resolution: {integrity: sha512-vz9iS7MJ5+Bp1URw8Khvdyw1H/hGvzHWlKQ7eRrQojSCDL1/SrWfrY9QebLw97n2deyRtzHRC3MkQfVNUCo91Q==}
engines: {node: '>=0.10'}
+ resolution: {integrity: sha512-iUDUQmFl3RanaBVLMDTZ6WtXj/Hk84pwJ5JWoJaQd1lXGifdApHhszI3biZvdBDdpTERCmB6x+7+uNvzhzVZIg==}
+ engines: {node: '>= 10'}
+
resolution: {integrity: sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==}
engines: {node: '>= 0.8.0'}
@@ -10532,6 +10620,11 @@ packages:
resolution: {integrity: sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==}
+ resolution: {integrity: sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==}
+ engines: {node: '>=0.10.0'}
+ hasBin: true
+
resolution: {integrity: sha512-+L3ccpzibovGXFK+Ap/f8LOS0ahMrHTf3xu7mMLSpEGU0EO9ucaysSylKo9eRDFNhWve/y275iPmIZ4z39a9iA==}
@@ -10915,6 +11008,9 @@ packages:
resolution: {integrity: sha512-JXNkRe6H6MjSlk5UQRTjyoKX5YN2zlc2632xcSlSFBao5yvbMWTpv9SNolOZlZmUlcDOHuszPLItbKrvcXnnZA==}
hasBin: true
+ resolution: {integrity: sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==}
+
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
engines: {node: '>= 0.8.0'}
@@ -11128,6 +11224,11 @@ packages:
resolution: {integrity: sha512-XQegIaBTVUjSHliKqcnFqYypAd4S+WCYt5NIeRs6w/UAry7z8Y9j5ZwRRL4kzq9U3sD6v+85er9FvkEaBpji2w==}
hasBin: true
+ resolution: {integrity: sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==}
+ deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
+ hasBin: true
+
resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==}
hasBin: true
@@ -11153,6 +11254,10 @@ packages:
react: ^16.8 || ^17.0 || ^18.0 || ^19.0.0 || ^19.0.0-rc
react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0.0 || ^19.0.0-rc
+ resolution: {integrity: sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==}
+ engines: {'0': node >=0.6.0}
+
resolution: {integrity: sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==}
@@ -11322,6 +11427,9 @@ packages:
engines: {node: '>=18'}
deprecated: Use @exodus/bytes instead for a more spec-conformant and faster implementation
+ resolution: {integrity: sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==}
+
resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==}
engines: {node: '>=18'}
@@ -17166,6 +17274,8 @@ snapshots:
'@types/[email protected]': {}
+ '@types/[email protected]': {}
+
'@types/[email protected]': {}
@@ -17196,6 +17306,12 @@ snapshots:
'@types/ms': 2.1.0
'@types/node': 24.3.0
+ '@types/[email protected]':
+ dependencies:
+ '@types/node': 24.3.0
+
+ '@types/[email protected]': {}
+
'@types/[email protected]': {}
'@types/[email protected]': {}
@@ -17227,6 +17343,10 @@ snapshots:
dependencies:
'@types/node': 24.3.0
+ '@types/[email protected]':
+ dependencies:
+ '@types/node': 24.3.0
+
optional: true
@@ -17294,6 +17414,10 @@ snapshots:
'@types/[email protected]': {}
+ '@types/[email protected]':
+ dependencies:
+ '@types/node': 24.3.0
+
'@types/[email protected]': {}
'@types/[email protected]': {}
@@ -17973,6 +18097,12 @@ snapshots:
+ dependencies:
+ safer-buffer: 2.1.2
+
+
@@ -18003,6 +18133,8 @@ snapshots:
dependencies:
possible-typed-array-names: 1.1.0
+
@@ -18090,6 +18222,10 @@ snapshots:
+ dependencies:
+ tweetnacl: 0.14.5
+
@@ -18444,6 +18580,8 @@ snapshots:
+
dependencies:
object-assign: 4.1.1
@@ -18542,6 +18680,10 @@ snapshots:
+ dependencies:
+ assert-plus: 1.0.0
+
@@ -18789,6 +18931,11 @@ snapshots:
+ dependencies:
+ jsbn: 0.1.1
+ safer-buffer: 2.1.2
+
dependencies:
safe-buffer: 5.2.1
@@ -18948,6 +19095,8 @@ snapshots:
+
optionalDependencies:
'@esbuild/aix-ppc64': 0.25.12
@@ -19465,6 +19614,8 @@ snapshots:
+
dependencies:
pure-rand: 6.1.0
@@ -19749,6 +19900,10 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ dependencies:
+ assert-plus: 1.0.0
+
dependencies:
citty: 0.1.6
@@ -19966,6 +20121,12 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ dependencies:
+ assert-plus: 1.0.0
+ jsprim: 1.4.2
+ sshpk: 1.16.1
+
dependencies:
agent-base: 6.0.2
@@ -20281,6 +20442,13 @@ snapshots:
+ dependencies:
+ node-fetch: 2.7.0
+ whatwg-fetch: 3.6.20
+ transitivePeerDependencies:
+ - encoding
+
dependencies:
lodash.capitalize: 4.2.1
@@ -20741,6 +20909,8 @@ snapshots:
dependencies:
argparse: 2.0.1
+
@@ -20804,6 +20974,8 @@ snapshots:
+
@@ -20833,6 +21005,15 @@ snapshots:
ms: 2.1.3
semver: 7.7.4
+ dependencies:
+ assert-plus: 1.0.0
+ extsprintf: 1.3.0
+ json-schema: 0.4.0
+ verror: 1.10.0
+
+
dependencies:
array-includes: 3.1.9
@@ -21923,6 +22104,38 @@ snapshots:
+ dependencies:
+ '@types/isomorphic-fetch': 0.0.35
+ '@types/jsonwebtoken': 9.0.3
+ '@types/jssha': 2.0.0
+ '@types/opossum': 4.1.1
+ '@types/sshpk': 1.10.3
+ es6-promise: 4.2.6
+ http-signature: 1.3.1
+ isomorphic-fetch: 3.0.0
+ jsonwebtoken: 9.0.3
+ jssha: 2.4.1
+ opossum: 5.0.1
+ sshpk: 1.16.1
+ uuid: 3.3.3
+ transitivePeerDependencies:
+ - encoding
+
+ dependencies:
+ await-semaphore: 0.1.3
+ oci-common: 2.127.0
+ oci-workrequests: 2.127.0
+ transitivePeerDependencies:
+ - encoding
+
+ dependencies:
+ oci-common: 2.127.0
+ transitivePeerDependencies:
+ - encoding
+
@@ -21976,6 +22189,8 @@ snapshots:
+
dependencies:
'@aashutoshrathi/word-wrap': 1.2.6
@@ -23174,6 +23389,18 @@ snapshots:
+ dependencies:
+ asn1: 0.2.6
+ assert-plus: 1.0.0
+ bcrypt-pbkdf: 1.0.2
+ dashdash: 1.14.1
+ ecc-jsbn: 0.1.2
+ getpass: 0.1.7
+ jsbn: 0.1.1
+ safer-buffer: 2.1.2
+ tweetnacl: 0.14.5
+
@@ -23557,6 +23784,8 @@ snapshots:
'@turbo/windows-64': 2.9.5
'@turbo/windows-arm64': 2.9.5
+
dependencies:
prelude-ls: 1.2.1
@@ -23789,6 +24018,8 @@ snapshots:
+
@@ -23812,6 +24043,12 @@ snapshots:
- '@types/react'
- '@types/react-dom'
+ dependencies:
+ assert-plus: 1.0.0
+ core-util-is: 1.0.2
+ extsprintf: 1.3.0
+
dependencies:
'@types/unist': 3.0.3
@@ -23977,6 +24214,8 @@ snapshots:
dependencies:
iconv-lite: 0.6.3
+
diff --git a/web/src/features/blobstorage-integration/blobstorage-integration-router.ts b/web/src/features/blobstorage-integration/blobstorage-integration-router.ts
index 26c7475c51..ecfa06e463 100644
--- a/web/src/features/blobstorage-integration/blobstorage-integration-router.ts
+++ b/web/src/features/blobstorage-integration/blobstorage-integration-router.ts
@@ -274,6 +274,7 @@ export const blobStorageIntegrationRouter = createTRPCRouter({
forcePathStyle: forcePathStyle || false,
useAzureBlob: type === BlobStorageIntegrationType.AZURE_BLOB_STORAGE,
useGoogleCloudStorage: false, // Not supported in blob storage integration
+ useOCIObjectStorage: false, // Not supported in blob storage integration
googleCloudCredentials: undefined,
awsSse: undefined,
awsSseKmsKeyId: undefined,
diff --git a/worker/src/__tests__/storageservice.test.ts b/worker/src/__tests__/storageservice.test.ts
index 1e938dd52a..64315e71ce 100644
--- a/worker/src/__tests__/storageservice.test.ts
+++ b/worker/src/__tests__/storageservice.test.ts
@@ -71,7 +71,20 @@ describe("StorageService", () => {
});
// Then
- expect(result.signedUrl).toContain(`${baseUrl}/${fileName}`);
+ if (env.LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE !== "true") {
+ expect(result.signedUrl).toContain(`${baseUrl}/${fileName}`);
+ } else {
+ expect(result.signedUrl).toMatch(/^https:\/\/.+oraclecloud\.com/);
+ expect(result.signedUrl).toContain("/p/");
+ expect(result.signedUrl).toContain("/o/");
+
+ // extract the object path after /o/ and decode (works whether the object name was percent-encoded)
+ const objMatch = result.signedUrl.match(/\/o\/(.+?)(?:$|[?#])/);
+ expect(objMatch).toBeTruthy();
+ const decodedObjPath = objMatch ? decodeURIComponent(objMatch[1]) : "";
+ expect(decodedObjPath).toContain(fileName);
+ }
+
const file = await storageService.download(fileName);
expect(file).toBe(data);
});
@@ -143,7 +156,12 @@ describe("StorageService", () => {
);
// Then
- expect(signedUrl).toContain(env.LANGFUSE_S3_EVENT_UPLOAD_ENDPOINT);
+ if (env.LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE !== "true") {
+ expect(signedUrl).toContain(env.LANGFUSE_S3_EVENT_UPLOAD_ENDPOINT);
+ } else {
+ expect(signedUrl).toMatch(/^https:\/\/.+oraclecloud\.com/);
+ expect(new URL(signedUrl).hostname).toContain("objectstorage");
+ }
expect(signedUrl).not.toContain("external-endpoint.example.com");
});
@@ -168,7 +186,12 @@ describe("StorageService", () => {
);
// Then
- expect(signedUrl).toContain(env.LANGFUSE_S3_EVENT_UPLOAD_ENDPOINT);
+ if (env.LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE !== "true") {
+ expect(signedUrl).toContain(env.LANGFUSE_S3_EVENT_UPLOAD_ENDPOINT);
+ } else {
+ expect(signedUrl).toMatch(/^https:\/\/.+oraclecloud\.com/);
+ expect(new URL(signedUrl).hostname).toContain("objectstorage");
+ }
expect(signedUrl).not.toContain("external-endpoint.example.com");
});
@@ -215,7 +238,13 @@ describe("StorageService", () => {
});
// Then
- expect(signedUrl).toContain(env.LANGFUSE_S3_EVENT_UPLOAD_ENDPOINT);
+
+ if (env.LANGFUSE_USE_OCI_NATIVE_OBJECT_STORAGE !== "true") {
+ expect(signedUrl).toContain(env.LANGFUSE_S3_EVENT_UPLOAD_ENDPOINT);
+ } else {
+ expect(signedUrl).toMatch(/^https:\/\/.+oraclecloud\.com/);
+ expect(new URL(signedUrl).hostname).toContain("objectstorage");
+ }
expect(signedUrl).not.toContain("external-endpoint.example.com");
});