Closed trentsgustavo closed 8 months ago
I managed to reproduce the issue by having the TypeOrmModule
class somewhere in the code like this:
so it's not a bug on TypeOrmModule
itself but rather some circular import introduced by @nestjs/typeorm
, I guess :thinking: pretty weird. That happens even if we import that class from '@nestjs/typeorm/dist/typeorm.module'
Also, that isn't related with Fastify adapter. It behaves the same with Express.
I've no ideia on what's happening so far.
I have similar problem
me too, I have similar problem
Not sure but it sounds like it might be related to the reflect-metadata package https://github.com/nestjs/nest/issues/13107#issuecomment-1919948793 (incompatibility between versions)?
yep, that's due to reflect-metadata
.
A quick solution is to pin the version of typeorm
to v0.3.19
As a general suggestion: be careful when upgrading packages that are under v0, guys. Make sure you're using lock files.
I'm wondering if we should change the peer dependency restriction of NestJS packages to not allow ^0.2.1 yet (just pin it to 0.1 instead) to avoid packages hoisting
Thanks @micalevisk the solution worked for me, in my case was a new project, so i followed the docs. But for sure is always a good practice to lock files
Is there an existing issue for this?
Current behavior
When using NestJS with Fastify and add TypeORM module, the @Body() decorator change to undefined and the body gets empty on Swagger
Minimum reproduction code
https://github.com/trentsgustavo/error-typeorm
Steps to reproduce
1
npm i
2npm run start:debug
3Do a request to /auth
4 Open swagger on http://localhost:3001, see empty body on /auth routeExpected behavior
When comment TypeORM Module, @Body() gets data, when uncomment @Body() is undefined
Package
Other package
@nestjs/typeorm
NestJS version
10.0.0
Packages versions
Node.js version
18.19.0
In which operating systems have you tested?
Other
No response