typeorm-transactional icon indicating copy to clipboard operation
typeorm-transactional copied to clipboard

Transactional decorator not working after dataSource re-initialized

Open ehdgus094 opened this issue 10 months ago • 1 comments

Thanks for the awesome library!

In AWS serverless environment, The DataSource has to be destroyed when the lambda request finishes and re-initialize on lambda warm-start in order to reduce the amount of the idle db connections.

On lambda cold-start, everything works fine because a new nest application gets initialized but, on lambda warm-start, the existing nest application is used and the transactional feature doesn't seem to work with the newly initialized DataSource.

I would like to know if there is any way to solve this problem. Thanks!

ehdgus094 avatar Apr 17 '24 08:04 ehdgus094

I found out that the issue wasn't because of destruction and re-initialization of DataSource. Transactional feature doesn't seem to work with TypeORM's lazy relation feature.

ehdgus094 avatar Apr 18 '24 02:04 ehdgus094