Skip to content

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

fix(storage): add max file limit to GCS and Azure listFiles (#11637)

Steffen Schmitzca4fb68b53c9
diff --git a/packages/shared/src/server/services/StorageService.ts b/packages/shared/src/server/services/StorageService.ts
index 3b56032702..ac34a6a91d 100644
--- a/packages/shared/src/server/services/StorageService.ts
+++ b/packages/shared/src/server/services/StorageService.ts
@@ -329,7 +329,7 @@ class AzureBlobStorageService implements StorageService {
try {
await this.createContainerIfNotExists();
- const result = await this.client.listBlobsFlat({ prefix });
+ const result = this.client.listBlobsFlat({ prefix });
const files = [];
for await (const blob of result) {
if (blob.name.startsWith(prefix)) {
@@ -337,6 +337,9 @@ class AzureBlobStorageService implements StorageService {
file: blob.name,
createdAt: blob?.properties?.createdOn ?? new Date(),
});
+ if (files.length >= env.LANGFUSE_S3_LIST_MAX_KEYS) {
+ break;
+ }
}
}
return files;
@@ -823,7 +826,10 @@ class GoogleCloudStorageService implements StorageService {
prefix: string,
): Promise<{ file: string; createdAt: Date }[]> {
try {
- const [files] = await this.bucket.getFiles({ prefix });
+ const [files] = await this.bucket.getFiles({
+ prefix,
+ maxResults: env.LANGFUSE_S3_LIST_MAX_KEYS,
+ });
return files.map((file) => ({
file: file.name,