multer
multer copied to clipboard
Binary file parsing on AWS lambda is broken
Using multer to parse a multipart form containing image files results in incorrect file content (larger and corrupted content) when run within an AWS lambda behind an AWS API gateway proxy.
@Craigfis - to prove of disprove this, can you provide a standalone test case?
I am unable to provide a standalone test case as it only fails when run as an AWS lambda called through an API gateway proxy. Other people have been reporting the same problem: https://stackoverflow.com/questions/51683399/how-to-use-multer-s3-in-aws-lambda-handler-as-middleware https://stackoverflow.com/questions/50989630/why-is-file-being-corrupted-during-multipart-upload-into-express-running-in-aws https://github.com/expressjs/multer/issues/597
Others have created specific parsers for handling this scenario: https://github.com/myshenin/aws-lambda-multipart-parser https://develandoo.com/blog/parsing-multipart-body-aws-lambda-function-serverless/
I'm still not clear on what multer would need to do differently to handle this scenario.
+1
How are you running Express on Lambda?
I don't think that this is an error in Multer, since I'm pretty sure that I've been using Multer on Lambda deployed via scandium without issue...