Open imhazard17 opened 5 months ago
I'd try to remove errForward
middleware since the last middleware is synchronous - for ensuring the req
context is not lost / overridden
In case it helps, I encountered similar after adding express-openapi-validator to an endpoint expecting a single file. req.file
was undefined but the uploaded file was still referenced in req.files[]
as a single entry.
When I try to upload file without chaining the middlewares, the file upload works but when I chain it with other middlewares like input validation and authentication the file does not upload and I get req.file/req.files object as undefined.
Kindly help me to find what the issue is as I have been not able to find one yet.
I use postman to test the api and have set the correct body, authorization token and form data but still the error persists.
Github link of the project: https://github.com/imhazard17/user_mvp
Endpoint
Authentication middleware
Input validation middleware