CodeGenieApp/serverless-express

both express.static and res.sendFile return wrong binary when serving a zip file

yspreen opened this issue · 2 comments

I'm not using any middleware except express.json and cors.

this is lambda.ts

import serverlessExpress from "@codegenie/serverless-express";
import app from "./app";
exports.handler = serverlessExpress({
  app,
  binaryMimeTypes: ["application/x-zip", "application/zip"],
});

I tried with and without specifying binaryMimeTypes and with and without the specific first route:

app.use("/done/ext.zip", (req, res) => {
  res.sendFile(path.join(__dirname, "public/ext.zip"));
});
app.use("/done", express.static("public"));
"@codegenie/serverless-express": "^4.14.0",
"express": "^4.19.2",

Having the same issue with some images being sent from express
image
It seems to wrap the buffer I want (the long one in the middle)
with a bunch of buffers I don't want on either side, causing it to corrupt