firebase-functions: Multipart upload is broken
Version info
**firebase-functions: 0.7.3
**firebase-tools: 3.15.4
**firebase-admin: 5.5.1
Hi,
i want use multer with my firebase functions. If i use the function with the emulator, it works but if i deploy, the function return this error:
ERROR TypeError: Cannot read property 'filename' of undefined
This is my code => https://pastebin.com/G0PzgtVg
It’s possible upload a file with the firebase functions?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 19 (1 by maintainers)
The guide tells you to use a low level library for multipart data processing, which is not ideal if you already are using some web framework. If you are using
express
for your http functions, you can use a forked version of multer middleware for processingmultipart/form-data
on cloud functions.Here’s what you can do.
@sarovin Thanks for the report and glad you found the answer on Stackoverflow, presently that’s the best way to deal with your issue.
… so is there any plan to fix this?
I get that this is in beta, but you’re really going to just silently break something, not document it and not even keep the bug report open?
Thanks @emadalam I spent a tonne of hours debugging. I set up demo project on node.js and my code worked with multer but break in cloud functions.
For the next person that stumbles across this issue: the official docs have some code: https://cloud.google.com/functions/docs/writing/http#multipart_data
Also interested in this. Any update?
I’m so glad this is closed with no solution. Guess I just won’t post data to a firebase function… 🤭
Thanks @emadalam for anwering, I followed the steps, and now its working
@ARPNetBR What does not work? The original multer library still doesn’t support this. If you want to use it, use the forked version in your npm dependency by pointing to the GitHub url https://github.com/emadalam/multer and then use the code sample as provided.
A few notes:
Did anybody looked at this in the past year?