fix: pass entire storage config to createStorage (gcsNativeStorage now detected)

Critical fix for GCS native storage configuration detection.

The setupStorage() method was only passing storage.type and storage.options,
but users provide gcsNativeStorage at the storage level, not inside options.

Before (broken):
  createStorage({
    type: config.storage.type,
    ...config.storage.options  // undefined!
  })

After (working):
  createStorage(config.storage)  // passes entire config including gcsNativeStorage

This fixes the "GCS native storage configuration is missing" error that caused
fallback to memory storage even when gcsNativeStorage was correctly configured.

Related to: v3.29.0 GCS native storage fixes
This commit is contained in:
David Snelling 2025-10-09 11:08:52 -07:00
parent 6453ba271f
commit 7a58dd774d

View file

@ -2611,10 +2611,9 @@ export class Brainy<T = any> implements BrainyInterface<T> {
* Setup storage
*/
private async setupStorage(): Promise<StorageAdapter> {
const storage = await createStorage({
type: this.config.storage?.type || 'auto',
...this.config.storage?.options
})
// Pass the entire storage config object to createStorage
// This ensures all storage-specific configs (gcsNativeStorage, s3Storage, etc.) are passed through
const storage = await createStorage(this.config.storage as any)
return storage
}