fox1t / fastify-multer

Fastify plugin for handling multipart/form-data
MIT License
89 stars 14 forks source link

Multer is not processing multipart/form-data #6

Closed the-yadu closed 4 years ago

the-yadu commented 4 years ago

I am using postman to upload a file to the route using fastify-multer. It throws the below error.

{ "statusCode": 415, "code": "FST_ERR_CTP_INVALID_MEDIA_TYPE", "error": "Unsupported Media Type", "message": "FST_ERR_CTP_INVALID_MEDIA_TYPE: Unsupported Media Type: multipart/form-data; boundary=--------------------------566739000861921958655834" }

fox1t commented 4 years ago

Hi. Can you please provide a reproduction repository here on GitHub so I can start further investigation using your setup?

the-yadu commented 4 years ago

Hmmm... Interesting As asked by you, I started making a reproduction repository with single file server.js and a single route to upload the file.

Screenshot 2020-04-02 at 2 28 33 PM

and I uploaded it without any issue. Strange. This got me thinking to do the same for my project.

I use fastify-autoloader to load the routes dynamically.

Then, I tried replicating the same in my project, I took the upload route and got it inside server.js file in root directly and made a route directly with server object. IT WORKED

Guess there is some issue with autoloader combining with multer.