Я получаю такую ошибку при загрузке файлов.я долгое время использовал пакет multer без каких-либо проблем.
Я использую облачное хранилище Google на узле v6.11.4
c
onst {Storage} = require('@google-cloud/storage')
const multer = require('multer');
//configuring the google cloud storage.
const storage = new Storage({
projectId: functions.config().project.id
//keyFilename: "<path to service accounts prviate key JSON>"
})
//const bucket = storage.bucket("<Firebase Storage Bucket URL");
const bucket = storage.bucket(functions.config().bucket.url)
//multer confguration.. middleware
const upload = multer({
storage: multer.memoryStorage(),
limits:{
fileSize: 5 * 1024 * 1024 // no larger than 5mb, you can change as needed.
}
})
exports.updateUserRole = functions.https.onRequest(upload.single('license'),(req,res) => {
I expect this file to be uploaded
Actual results
TypeError: next is not a function at multerMiddleware (/user_code/node_modules/multer/lib/make-middleware.js:18:41) at cloudFunction (/user_code/node_modules/firebase-functions/lib/providers/https.js:57:9) at /var/tmp/worker/worker.js:726:7 at /var/tmp/worker/worker.js:709:11