Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store is undefined with new version of cache-manager. #43

Closed
smasilamani-cfins opened this issue Oct 14, 2022 · 6 comments
Closed

Store is undefined with new version of cache-manager. #43

smasilamani-cfins opened this issue Oct 14, 2022 · 6 comments

Comments

@smasilamani-cfins
Copy link

smasilamani-cfins commented Oct 14, 2022

Hi

Thanks for rewriting this package. We updated the cache-manager to the latest version(5.0.1) and things started breaking ever since. Please see below the error we get.

private configRedisStore(): void {
		const configObj: any = {
			store: IoRedisStore,
			clusterConfig: null,
			host: null,
			port: null,
			ttl: null,
			connectTimeout: 5000,
			tls: null,
			// eslint-disable-next-line camelcase
			socket_keepalive: true
		};

		if (
			this.dsConfig.node.app_env.toUpperCase() === DSServerConstants.PROD_ENV ||
			this.dsConfig.node.app_env.toUpperCase() === DSServerConstants.UAT_ENV ||
			this.dsConfig.node.app_env.toUpperCase() === DSServerConstants.DEV_ENV
		) {
			configObj.tls = {};
		}

		if (this.dsConfig.aws.elasticCache.clusterConfig) {
			configObj.clusterConfig = this.dsConfig.aws.elasticCache.clusterConfig;
		} else {
			configObj.host = this.dsConfig.aws.elasticCache.host;
			configObj.port = this.dsConfig.aws.elasticCache.port;
		}

		// Promisify all the functions
		this.redisCache = caching(configObj);
		const cacheStore: Store = this.redisCache.store as Store;
		this.redisClient = cacheStore.getClient();
	}

Error

2022-10-14 10:32:25.831 [error] - TypeError: Cannot read properties of undefined (reading 'getClient')

It looks like the cacheStore is undefined.

@Tirke
Copy link
Owner

Tirke commented Oct 17, 2022

Hello @saachinsiva thanks for opening this issue. The new version of cache manager is a major bump and I need to invest a bit of time checking and updating everything to handle the changes. I'll do my best to look at it soon.

@curtdept
Copy link

@saachinsiva IoRedisStore.create to get a "RedisStore" thats compatible

@NarHakobyan
Copy link

getting error too.

image

@Tirke
Copy link
Owner

Tirke commented Oct 21, 2022

@NarHakobyan @saachinsiva I've just published 3.0.0 that is the new version of this package, working with the new cache-manager version > 5.

@Tirke Tirke closed this as completed Oct 21, 2022
@guotingchao
Copy link

Use the version 3.0.0, Getting same error

getting error too.

image

Use the version 3.0.0, But getting the same error.

@Tirke
Copy link
Owner

Tirke commented Oct 30, 2022

@guotingchao

  1. The API for this package changed please check the README to see how initialisation is done now
  2. Nestjs is not compatible with the new cache-manager version you can follow this issue here NestJS v9 incompatible with version 5 jaredwray/cacheable#210. Please stay on v4 of cache-manager and v2 of this one here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants