You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a fastify project that is using fastify-multipart for a file upload endpoint. With fastify-multipart registered, all requests sent to my api, including endpoints that have nothing to do with files, will return an error from the openapi-validator:
🚀 ~ requestFilesExtractor.js
🚀 ~ req.file: [AsyncFunction: getMultipartFile]
🚀 ~ req.files: [AsyncGeneratorFunction: getMultipartFiles]
🚀 ~ app.setErrorHandler ~ error: TypeError: files.push is not a function
at module.exports (C:\wrkspc\...\app\node_modules\openapi-validator-middleware\src\utils\requestFilesExtractor.js:7:19)
requestFilesExtractor.js file checks if req.file or req.files exists, and then proceeds to do other stuff. When fastify-multipart is registered, req.file and req.files are async functions and so they pass the check for existence, but then the proceeding logic bombs out when it tries handle them.
This has probably something to do with openapi-validator using express/multer under the hood but I'm not sure of a path forward except maybe having to install fastify-express along with express/multer and redoing my controller logic for handling files..
The text was updated successfully, but these errors were encountered:
I have a fastify project that is using fastify-multipart for a file upload endpoint. With fastify-multipart registered, all requests sent to my api, including endpoints that have nothing to do with files, will return an error from the openapi-validator:
requestFilesExtractor.js file checks if req.file or req.files exists, and then proceeds to do other stuff. When fastify-multipart is registered, req.file and req.files are async functions and so they pass the check for existence, but then the proceeding logic bombs out when it tries handle them.
This has probably something to do with openapi-validator using express/multer under the hood but I'm not sure of a path forward except maybe having to install fastify-express along with express/multer and redoing my controller logic for handling files..
The text was updated successfully, but these errors were encountered: