I have an http-triggered cloud function that works fine in the emulator but throws errors when deployed.
var multer = require('multer');
var storage = multer.memoryStorage()
var multerUpload = multer({ storage: storage })
exports.selfie = function (req, res) {
console.log ("START");
console.log (req.body);
// perf logging
const startTime = process.hrtime();
let markers = [];
// data middleware
let handle = multerUpload.single("image");
handle(req, res, (err) => {
console.log (">body");
console.log (req.body);
console.log (">file")
console.log (req.file);
})
}
In the emulator it acts as expected: The first console.log returns an empty object, the one after >body gives me all my POST variables, and the last a reference to uploaded image. It's being POSTed as a multipart form.
But when I deploy in prod the first console.log gives me a buffer, the second an empty object, and the file is undefined. POSTing the exact same data.