-
Notifications
You must be signed in to change notification settings - Fork 180
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
NestJS v9 incompatible with version 5 #210
Comments
I have the same issue |
same here |
same here...back to version @4.1.0 and wait |
The cache construction is now async. Thats why you need to await it. I also have issues with this: dependency injection with both Awilix and NestJS is breaking. Constructors should be sync. Why is this Promise based now? Can this be avoided or made sync as fallback for users who don't have the luxury of awaiting? |
+1 for a fix for this |
After some investigation, it appears the This change was rather hard to find as the old |
My fix for NestJS was to downgrade to This is also forced by @micalevisk 's PR here. |
+1 for a fix. I believe this is the commit that broke everything. A "Breaking Changes" should have been issued. |
Sorry for the delay. It is that there are breaking changes that have not been introduced in the NestJS documentation because the version is very early. Now I put an example of how to implement it with the new version while it is being updated in NestJS. |
I'm no longer the maintainer of this project, but:
But I also agree that the constructors should not be async. |
@WaylonOKC as this was over a semver major version, a breaking change was fine. It's just that until now, Nest's peerDeps were okay with any version of |
The problem is: I have changed the definition of the function Specify in the NestJS documentation and its dependencies. I already have the commit to update NestJS but it won't take long until they release a version. I'll leave this open if anyone has the same problem:
|
Any chance of adding a bit of documentation on how to achieve the same results with the new version? I too am trying to update my code to v5 but following just the commit messages seems a bit confusing and I'm getting similar type errors when using the Not complaining, just would like to know if we could have a thorough guide on how to update from one version to another. Thanks! |
Ok, I'll make a guide. But this is what I did to migrate this Store. Other Store implementations may not have updated types |
Breaking changes are often expected by a major version, but they definitely should be called out and not just left to be discovered after people upgrade. FWIW, this thread started out as a "TypeError" and not specifically a NestJS incompatibility. |
Hi Team, |
@srinivasan-getstan there's nothing really to update. botika was kind enough to provide an example of how to use |
Thanks, @jmcdo29 |
Basically, I did 12020d8 and remove it. |
|
For the ones using |
I'm getting the same error and it looks like it hasn't been updated yet ! |
If you are coming here from the NestJS caching Redis tutorial, use these dependencies:
@vincentwinkel thanks |
I can confirm that using the latest NestJS version (9.2.1) solves this issue for me. Looks like anything north of 9.1.3 should address the issue, which is when this was merged: nestjs/nest@4eb5fb0 |
Fixed in nest@9.2.0 Thanks all!! |
Hi. This still does not work for me even after updating it to 9.2.0.
Versions: |
This is work for me.
It should be noted that |
Is not updated. Use https://github.com/node-cache-manager/node-cache-manager#official-and-updated-to-last-version instead |
Hello, I'm having the original issue of @rurruur
My setup:
Backend: Other: Update
|
The awser is in the last post. And install Linux, archlinux, https://wiki.archlinux.org/title/installation_guide |
to resolve that i need to change the "cache-manager": "^4.0.0", and if you use redis "cache-manager-redis-store": "2.0.0", this resolved from me |
I managed to solve this with:
My module file:
My provider file:
You are welcome. |
My import { Module } from '@nestjs/common';
import { CacheModule as _CacheModule } from '@nestjs/cache-manager';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { RedisClientType } from 'redis';
import { redisInsStore } from 'cache-manager-redis-yet';
import { REDIS, RedisModule } from '@app/redis';
import { CacheService } from './cache.service';
@Module({
imports: [
_CacheModule.registerAsync({
imports: [ConfigModule, RedisModule],
inject: [ConfigService, REDIS],
useFactory: (config: ConfigService, redis: RedisClientType) => {
const conf = {
ttl: config.getOrThrow<number>('REDIS_CACHE_TTL'),
};
return {
store: redisInsStore(redis, conf),
...conf,
};
},
}),
],
providers: [CacheService],
exports: [_CacheModule, CacheService],
})
export class CacheModule {} My import { Inject, Injectable } from '@nestjs/common';
import { CACHE_MANAGER } from '@nestjs/cache-manager';
import { RedisCache } from 'cache-manager-redis-yet';
@Injectable()
export class CacheService {
constructor(@Inject(CACHE_MANAGER) public readonly cache: RedisCache) {}
async clean(pattern: string) {
for await (const key of this.cache.store.client.scanIterator({
MATCH: pattern,
})) {
await this.cache.store.client.unlink(key);
}
}
} Thanks all for use it! |
@botika may I know if there's a repo of that code you sent above? I would like to check it. Thanks. |
v5 is incompatible with nestjs jaredwray/cacheable#210
wrote a fix for newer version of cache-manager(v5 and above) on stackoverflow, it should help https://stackoverflow.com/a/76777854/16362460 |
i get this error
Im implementing caching following the NestJS docs.
this is my posting on stackoverflow (https://stackoverflow.com/questions/73908197/typeerror-store-get-is-not-a-function-nestjs-cache-manager)
but when im switch to version4 then its working.. but i dont know why.
i wonder this is just my fault or version issue
-> i try to find difference but i think
get
method's logic is same(using lru-cache package). so maybe type issue?if this is my fault, then can you tell me how to solve it?
The text was updated successfully, but these errors were encountered: