CodeGenieApp / CodeGenieApp/serverless-express

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

Offen
#677 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
5.3k
Forks
676
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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:

```ts
app.use("/done/ext.zip", (req, res) => {
res.sendFile(path.join(__dirname, "public/ext.zip"));
});
app.use("/done", express.static("public"));
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start with lambda.ts and app, then reproduce the /done/ext.zip res.sendFile route and the /done express.static route using the shown binaryMimeTypes settings. Compare the returned zip bytes with public/ext.zip in the Lambda environment; done means both routes return a valid, uncorrupted zip file.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
aws, express, javascript, node.js, typescript
Bereich
api, backend, cloud
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.