-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
ParseFilePipeBuilder Cannot read properties of undefined (reading 'size') when upload file #10017
Comments
You know, linking to our own code isn't a minimum reproduction. I'm surprised this happens rather than multer throwing an exception as interceptors are triggered before pipes. Please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project). |
i'm sorry, I have updated the minimum reproduction. |
Okay, I can confirm that multer only cares about the field existing, not necessarily that there is a file to parse there. We should probably add a |
cc @thiagomini |
I'll have a look on that and work in a fix asap, thanks for reporting! |
@kamilmysliwiec Created a PR with the fix for this issue, would appreciate your review on that |
I'm dealing with the same issue as this, where I have an optional file upload field. While PR seems like a good solution, is there any way to use the
|
Let's track this here #10025 |
Is there an existing issue for this?
Current behavior
i'm uploading image file using form-data, when i don't attach file then in ParseFilePipeBuilder function i get error
ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'size')
Minimum reproduction code
https://stackblitz.com/edit/nestjs-typescript-starter-amuib7
Steps to reproduce
No response
Expected behavior
We must to create a validation function on
ParseFilePipeBuilder
when the file doesn't exist during upload.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
No response
NestJS version
9.0.5
Packages versions
Node.js version
No response
In which operating systems have you tested?
Other
No response
The text was updated successfully, but these errors were encountered: