The App:
I currently have a simple web application built using FastAPI and Mangum to deploy it onto an AWS Lambda. The Lambda sits behind API Gateway. The web application consists of a form in which the user can upload an excel file, which will then be stored into an s3 bucket for downstream processing.
The Problem:
Currently, the app works perfectly locally. However, when deployed onto the Lambda and API Gateway, the excel files that come out of the program are corrupted and cannot be programmatically accessed later. Trying to open the file using pandas.read_excel or openpyxl results in this error: zipfile.BadZipFile: File is not a zip file
Expectation
I was expecting the .xlsx file to come out on the other side with no problems. It works as expected locally, but gets corrupted when deployed.
What I've tried
I came across this stackoverflow answer and followed the instructions that it outlined with no success. I also tried encoding the .xlsx file to base64 before sending per this stack overflow answer: https://stackoverflow.com/a/60725342/13808287 which did not work. I have also been playing around with various API Gateway configurations and none have worked although I might just not have found the right one.