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

Unable to call cacheManager properly when there is a cyclic dependency #341

Closed
2 of 4 tasks
liaorg opened this issue Mar 15, 2024 · 1 comment
Closed
2 of 4 tasks
Labels
bug Something isn't working

Comments

@liaorg
Copy link

liaorg commented Mar 15, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

role.services.ts like this:
...
@Inject(forwardRef(() => MenuService)) private readonly menuService: WrapperType,
.....

base.service.ts :
.....
async setCache(param: { value: any; key?: string; ttl?: Milliseconds }) {
const { key = this.cacheKey, value, ttl } = param;
return await this.cacheManager.set(key, value, ttl);
}
......

=============
unhandledRejection: TypeError: Cannot read properties of undefined (reading 'set')
at RoleService.setCache (C:\work\dasplus\src\common\services\base.service.ts:45:40)
at C:\work\dasplus\src\common\services\base.service.ts:38:24
at processTicksAndRejections (node:internal/process/task_queues:95:5)

Minimum reproduction code

Steps to reproduce

No response

Expected behavior

can use

Package version

^5.4.0

NestJS version

^10.3.3

Node.js version

v18.14.1

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@liaorg liaorg added the bug Something isn't working label Mar 15, 2024
@kamilmysliwiec
Copy link
Member

Thank you for taking the time to submit your report! From the looks of it, this could be better discussed on our Discord. If you haven't already, please join here and send a new post in the #⁠ 🐈 nestjs-help forum. Make sure to include a link to this issue, so you don't need to write it all again. We have a large community of helpful members, who will assist you in getting this to work.

@nestjs nestjs locked and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants