Multer: empty req.body and req.file when run in firebase hosting

Created on 27 Mar 2018  路  5Comments  路  Source: expressjs/multer

I don't know if its the problem of firebase or multer .

app.post('/' ,  multer({ dest: "data/" , limits : { fileSize : 5242880 } }).single('image_file'),  (req , res)=>{

    console.log("req.body : " , req.body) ;
    console.log("req.file  : " , req.file) ; 

It works fine on my local server but when I deploy it to firebase , it gives me empty req.body and req.file . How to fix this ?

Most helpful comment

I found out that a firebase update made this multer module unworkable . So we can't use multer with firebase hosting now .

Read this
Handling multipart data

All 5 comments

Same problem here, any solution?

I found out that a firebase update made this multer module unworkable . So we can't use multer with firebase hosting now .

Read this
Handling multipart data

Thanks for the reply, I found this yesterday https://stackoverflow.com/questions/47242340/how-to-perform-an-http-file-upload-using-express-on-cloud-functions-for-firebase .
I had fix the problem with the express-multipart-file-parser is the eases way.
Thanks again!

Did express-multipart-file-parser module work for u after deploying?

I thought the only working solution was to use the busboy module which required lot of bloatware code.

Thanks for pointing out the firebase bug! I ended up using busboy. It was the only way that worked for me. 2 days on this so far!

Was this page helpful?
0 / 5 - 0 ratings