H4ad / serverless-adapter-examples

Working examples to show how to integrate with https://github.com/H4ad/serverless-adapter
https://viniciusl.com.br/serverless-adapter
MIT License
12 stars 0 forks source link

AWS uploading files #5

Open ElectricPulse opened 1 month ago

ElectricPulse commented 1 month ago

What are my options if I want to have a post request with a file attached with AWS? Ideally I want to use something like form-data but with express-form-data that doesn't seem to work.

H4ad commented 1 month ago

From the top of my head, this should work without issues.

The body is encoded in base64 if you enable the binary data (inside AWS), ref: https://stackoverflow.com/a/41770688

Inside the lambda, you will need a lib to parse the form-data to actual data, with express-form-data for example.

In case it didn't work, case a repo with the reproduction and I can take a look

ElectricPulse commented 1 month ago

The issue ended up being that I used http and not https. Using HTTP returned a rather funny message of 404 status code with the body: Internal Server Error. This could be due to our CDK template, which I don't manage.