Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

TypeError: Cannot read property 'length' of undefined #14

Open
mirasel opened this issue Mar 15, 2022 · 0 comments
Open

TypeError: Cannot read property 'length' of undefined #14

mirasel opened this issue Mar 15, 2022 · 0 comments

Comments

@mirasel
Copy link

mirasel commented Mar 15, 2022

Hi,
I've been trying to upload image with transform using this package. but I don't want to upload file larger than 1MB in size. So, I've set my multer as following,

const upload = multer({
  storage,
  limits: { fileSize: 1000000 }, //1000000 bytes = 1MB
  fileFilter: function (req, file, cb) {
    checkFileType(file, cb);
  },
});

When I upload file smaller than 1MB, It works fine. If I give a file larger than 1MB, it should give me MulterError with LIMIT_FILE_SIZE code. But it gives me TypeError: Cannot read property 'length' of undefined

this is the error stack

TypeError: Cannot read property 'length' of undefined
    at FileAppender.removePlaceholder (D:\mirasel\Test_project\node_modules\multer\lib\file-appender.js:48:49)
    at D:\mirasel\Test_project\node_modules\multer\lib\make-middleware.js:147:22
    at ManagedUpload.callback (D:\mirasel\Test_project\node_modules\multer-s3-transform\index.js:400:29)
    at ManagedUpload.cleanup (D:\mirasel\Test_project\node_modules\aws-sdk\lib\s3\managed_upload.js:635:10)
    at Sharp.<anonymous> (D:\mirasel\Test_project\node_modules\aws-sdk\lib\s3\managed_upload.js:187:44)
    at Sharp.emit (events.js:400:28)
    at Sharp.emit (domain.js:470:12)
    at Object.<anonymous> (D:\mirasel\Test_project\node_modules\sharp\lib\output.js:1075:18)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant