Closed snps-achim closed 9 months ago
This should be fixed in v7.3.0 in combination with @nestjs/{core, common}@10.3.2
(https://github.com/nestjs/nest/issues/13107)
This should be fixed in v7.3.0 in combination with
@nestjs/{core, common}@10.3.2
(nestjs/nest#13107)
That's great Kamil. Thanks for doing all this work on this amazing framework.
Is there an existing issue for this?
Current behavior
When using latest "@nestjs/swagger": "7.2.0" and "@nestjs/typeorm": "10.0.1", then the NestJS application start is failing during bootstrap with "Error: A circular dependency has been detected (property key: "level"). Please, make sure that each side of a bidirectional relationships are using lazy resolvers".
Root cause
"reflect-metadata": "^0.1.13"
is required for@nestjs\swagger
to work."typeorm":"0.3.20"
was introduced by"@nestjs\typeorm":"10.0.1"
installed"reflect-metadata": "^0.2.0"
undernode_modules/typeorm/node_modules/reflect-metadata
.When stepping through the code, for unknown reasons this wrong version
node_modules/typeorm/node_modules/reflect-metadata
is picked up by@nestjs\swagger
instead ofnode_modules/reflect-metadata
failing to get meta data for Swagger and causing the errorWorkaround
Minimum reproduction code
https://github.com/snps-achim/nestjs-swagger-typeorm-problem
Steps to reproduce
Clone
Installation
NPM
SQL
Also, you need an SQL server and adjust password under ./src/app.module.ts)
Running the app
Expected behavior
Application shall start normally.
Instead, the following errors are provided:
Package version
7.2.0
NestJS version
10.3.1
Node.js version
18.16.1
In which operating systems have you tested?
Other
No response