Papooch / nestjs-cls

A continuation-local storage (async context) module compatible with NestJS's dependency injection.
https://papooch.github.io/nestjs-cls/
MIT License
434 stars 28 forks source link

Factory Proxy Providers doesn't work #48

Closed kkkstars closed 1 year ago

kkkstars commented 1 year ago

Hi: I use Factory Proxy Providers , tenant database connection example. The provide "TENANT_CONNECTION" unavailable in my context. Could you give some more detail with tenant database connection example, like Quick Start example? Where to use ClsModule.forFeature? Use ClsModule.forFeature or ClsModule.forFeatureAsync? ClsModule.forFeature 'provide' argument ERROR

Thank you

Papooch commented 1 year ago

Here's the tests for the feature: https://github.com/Papooch/nestjs-cls/blob/main/test/proxy-providers/proxy-providers.spec.ts Could you share a reproduction I could look into?

Keep in mind that the provider must be available in the context of the module in which you're using it, so If you define the proxy provider in one module (Module A) and use it in another (Module B), you might have to export the ClsModule from that module (Module A) (https://docs.nestjs.com/modules#module-re-exporting) to make the proxy provider available in the other (Module B).

kkkstars commented 1 year ago

thank you, i will try.

Papooch commented 1 year ago

@kkkstars have you resolved your issue?