Serve zip file from AWS Lambda


I need an endpoint (serverless) that serves a series of files compressed in a zip file. To do this I am using node-zip. This works locally to create a simple zip file with a flat file text:

But when I try to implement it in a lambda the downloaded zip file is corrupted:

Why do I get a corrupted zip file?


What I did in the end to fix this:


You can try encoding the response as Base64 encoded string by adding isBase64Encoded: true in the response object.

Leave a Reply