alphamikle / nest_transact

Simplest transactions support for Nestjs with Typeorm
MIT License
116 stars 20 forks source link

fix: could not get parameter from `design:paramtypes` metadata key #37

Closed chhoangcmc closed 1 year ago

chhoangcmc commented 1 year ago

Hi @alphamikle , Thank you very much for this helpful package! Currently I have encountered an issue when developing my application.

TLDR;

The problem here is that nest-transact does not have logic to handle dependency of configuration objects from ConfigModule(Documentation | NestJS - A progressive Node.js framework ).

What happens?

When we wrap a NestJS service with nest-transact with the usage of withTransact function, the dependency of configuration objects (ConfigType) which we get from Reflect.getMetadata('design:paramtypes', constructor) would be undefined, and nest-transact does not have logic to handle this kind of dependency, causing the application to be crashed.

The dependency of configuration object does exist, but with other metadata key 'self:paramtypes'. image

image

Troubleshooting

I have created this PR for the fix. Please take a look and I am looking forward to your approval. Many thanks 🙏

chhoangcmc commented 1 year ago

Sorry that I could not assign the reviewer :( Please take a look, @alphamikle

chhoangcmc commented 1 year ago

Hi @alphamikle , thank you for the approval of the merge! Could you please publish the new version of nest-transact?

alphamikle commented 1 year ago

Hi @chhoangcmc! Version 9.1.2 is on the market. Thank you for your PR!