nestjs / cache-manager

Cache manager module for Nest framework (node.js) 🗃
MIT License
114 stars 20 forks source link

registerAsync + global does not work #349

Closed JacobSiegle closed 3 months ago

JacobSiegle commented 3 months ago

Is there an existing issue for this?

Current behavior

The modules providers are not found even though the module is specified as global.

Minimum reproduction code

https://stackblitz.com/edit/nestjs-typescript-starter-j7sze2?file=src%2Fapp.module.ts&terminal=start

Steps to reproduce

Stackblitz - Error: Nest can't resolve dependencies of the SubService (?). Please make sure that the argument "CACHE_MANAGER" at index [0] is available in the SubModule context.

Potential solutions:

Expected behavior

The modules providers work like register

Package version

2.2.1

NestJS version

10.3.1

Node.js version

18

In which operating systems have you tested?

Other

No response

kamilmysliwiec commented 3 months ago

image

JacobSiegle commented 3 months ago

@kamilmysliwiec Thanks!

useFactory?: (...args: any[]) => Promise<CacheModuleOptions> | CacheModuleOptions;

CacheModuleOptions has isGlobal when using registerAsync, I noticed you closed but do you think the type is worth fixing?

kamilmysliwiec commented 3 months ago

Oh yeah it is! Would you like to create a PR?