-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClassSerializerInterceptor: .classToPlain is not a function #8637
Labels
needs triage
This issue has not been looked into
Comments
12 tasks
I have the same issue, when I try to add any validation I get this error. |
Downgrade to less than 0.5.0 for class-transformer. In your package.json you should be able to do |
thank you, it working now. |
Thank you guys |
apricote
added a commit
to apricote/Listory
that referenced
this issue
Nov 21, 2021
Let's track this here #8638 |
tiagojsag
added a commit
to Vizzuality/landgriffon
that referenced
this issue
Nov 22, 2021
tiagojsag
added a commit
to Vizzuality/landgriffon
that referenced
this issue
Nov 22, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
For those looking for a quick fix,
Downgrade to
class-transformer: 0.4.0
:npm install class-transformer@0.4.0
yarn add class-transformer@0.4.0
Is there an existing issue for this?
Current behavior
When a controller uses ClassSerializerInterceptor, it will throw a
TypeError: classTransformer.classToPlain is not a function
due to a breaking change in the latest release https://github.com/typestack/class-transformer/blob/develop/CHANGELOG.mdMinimum reproduction code
https://github.com/nestjs/nest/tree/master/sample/21-serializer
Steps to reproduce
Expected behavior
To serialize the data correctly.
Package
@nestjs/common
@nestjs/core
@nestjs/microservices
@nestjs/platform-express
@nestjs/platform-fastify
@nestjs/platform-socket.io
@nestjs/platform-ws
@nestjs/testing
@nestjs/websockets
Other package
class-serializer
NestJS version
8.2.2
Packages versions
"@nestjs/common": "^8.2.2"
"@nestjs/core": "^8.2.2"
"class-transformer": "^0.5.0"
"class-validator": "^0.13.2"
Node.js version
v16.6.1
In which operating systems have you tested?
Other
The changes in class-validator have fixed the security vulnerabilities and have changed the names of the functions used. This should be patched asap, as this would benefit those who are not using the nestjs/class-transformer.
The text was updated successfully, but these errors were encountered: