#@Req still undefinied with reflect-metadata@^0.2

1 messages · Page 1 of 1 (latest)

small thistle
#

Last week, I had a problem with the @normal gust object being undefined. I discovered that the issue was related to the reflect-metadata version not matching the one used by the typeorm package. To address this, I downgraded typeorm to version 0.3.19, which resolved the issue.

However, today, I encountered the same problem again, and unfortunately, the previous solution didn't work. After seeking help on the support channel, I learned of another solution that seemed to work for others: upgrading the reflect-metadata version to ^0.2.1. Despite trying this, my @normal gust body remains undefined.

  "dependencies": {
    "@hapi/joi": "^17.1.1",
    "@nestjs/common": "^10.3.3",
    "@nestjs/config": "^3.2.0",
    "@nestjs/core": "^10.3.3",
    "@nestjs/mapped-types": "^2.0.5",
    "@nestjs/platform-express": "^10.0.0",
    "@nestjs/platform-fastify": "^10.3.3",
    "@nestjs/typeorm": "^10.0.2",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.14.1",
    "mysql2": "^3.9.2",
    "reflect-metadata": "^0.2.1",
    "rxjs": "^7.8.1",
    "typeorm": "^0.3.20"
  },
odd bramble
#

Interesting. What's your package manager of choice?

small thistle
#

@odd bramble I use Yarn

odd bramble
#

yarn why reflect-metadata

#

Just to make sure there's only one version installed

small thistle
#

@odd bramble

odd bramble
#

Hmm seems fine. Any chance you can share the project then? this should probably be resolved from the known issues I'm aware of

small thistle
odd bramble
small thistle
odd bramble
#

Okay, what endpoint do you hit?

restive leaf
#

I bet you can reproduce that without configuring typeorm, if it's an issue with @Body()

#

I tried to run your repro with no success by now

small thistle
restive leaf
#

I tried a minimum repro with all the dependencies like in your project but everything went fine
pretty weird

small thistle
#

The problem comes when we import TypeOrm into the app.module, if we don't put it there will be no problem the @Body will work fine

I had the same problem last week, and I found this solution (change the version of TypeORM) but now it still doesn't work

GitHub

Is there an existing issue for this? I have searched the existing issues Current behavior When using NestJS with Fastify and add TypeORM module, the @Body() decorator change to undefined and the bo...

restive leaf
#

here this went fine as well 🤔

odd bramble
# small thistle **POST /admins**

Generally it works as I'm expecting it to. As your CreateAdminDto has no class-vadliator decorators it's coming in as {} due to the validation pipe