But the gist is that I’m trying to parse an image upload from a function/lambda event and it doesn’t appear to be working. I’ve tried using busboy and also aws-lambda-multipart-parser. I can get a resulting buffer from both, but it seems to be malformed each time. I’ve tried checking the mime type with file-type and also trying to load the parsed image buffer into Jimp and get the following error: Could not find MIME for buffer (null). So it seems like, at least from these experiences, that part of the form data is getting malformed/dropped along the way.

Could you tell us more about your workflow? For instance, if you are using an event-triggered function you wouldn’t have any uploaded file data in the body - it would be a URL to the data. But perhaps you mean you wrote a function that accepts POSTs and you’re having trouble parsing the data directly off the wire?

Yup, it’s the latter! I’m posting directly to an endpoint. The errors I wrote about in the OP occur while running on Netlify/deployed to Lambda. Also when I use Netlify Dev the . parse.on('file', cb) never even occurs.

I don’t actually think that will work right now. I’ve opened an issue regarding adding support for multi-part requests to Netlify functions, and added a link to this thread so we’ll let you know once we have more info. Sorry about that @dmmulroy!

I ended up switching to straight up using API Gateway and Lambda and got https://www.npmjs.com/package/lambda-multipart working. Although my lambda function takes >29 seconds on images >650kb so I’m getting time outs so I’m rewriting from Node -> Go

I imagined 650kb to be trivial for node to handle, didn’t think it would’ve required rewriting to Go. Well, I didn’t imagine sending email with attachment to be a hassle too. PS: I’m a newer developer, devs on Twitter always talk about how easy it was to set up Rails back in the day. Sorry for ranting