diff --git a/packages/twenty-server/src/engine/core-modules/cache-storage/cache-storage.module-factory.ts b/packages/twenty-server/src/engine/core-modules/cache-storage/cache-storage.module-factory.ts index 3a7928e48a50..669b0b523b35 100644 --- a/packages/twenty-server/src/engine/core-modules/cache-storage/cache-storage.module-factory.ts +++ b/packages/twenty-server/src/engine/core-modules/cache-storage/cache-storage.module-factory.ts @@ -4,11 +4,9 @@ import { redisStore } from 'cache-manager-redis-yet'; import { CacheStorageType } from 'src/engine/core-modules/cache-storage/types/cache-storage-type.enum'; import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; -import { RedisClientService } from 'src/engine/core-modules/redis-client/redis-client.service'; export const cacheStorageModuleFactory = ( environmentService: EnvironmentService, - redisClientService: RedisClientService, ): CacheModuleOptions => { const cacheStorageType = environmentService.get('CACHE_STORAGE_TYPE'); const cacheStorageTtl = environmentService.get('CACHE_STORAGE_TTL'); @@ -22,10 +20,18 @@ export const cacheStorageModuleFactory = ( return cacheModuleOptions; } case CacheStorageType.Redis: { + const redisUrl = environmentService.get('REDIS_URL'); + + if (!redisUrl) { + throw new Error( + `${cacheStorageType} cache storage requires REDIS_URL to be defined, check your .env file`, + ); + } + return { ...cacheModuleOptions, store: redisStore, - client: redisClientService.getClient(), + url: redisUrl, }; } default: diff --git a/packages/twenty-server/src/engine/core-modules/cache-storage/cache-storage.module.ts b/packages/twenty-server/src/engine/core-modules/cache-storage/cache-storage.module.ts index dbefb4284578..3f12d09e6d98 100644 --- a/packages/twenty-server/src/engine/core-modules/cache-storage/cache-storage.module.ts +++ b/packages/twenty-server/src/engine/core-modules/cache-storage/cache-storage.module.ts @@ -7,7 +7,6 @@ import { FlushCacheCommand } from 'src/engine/core-modules/cache-storage/command import { CacheStorageService } from 'src/engine/core-modules/cache-storage/services/cache-storage.service'; import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum'; import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; -import { RedisClientService } from 'src/engine/core-modules/redis-client/redis-client.service'; @Global() @Module({ @@ -16,7 +15,7 @@ import { RedisClientService } from 'src/engine/core-modules/redis-client/redis-c isGlobal: true, imports: [ConfigModule], useFactory: cacheStorageModuleFactory, - inject: [EnvironmentService, RedisClientService], + inject: [EnvironmentService], }), ], providers: [