Closed btakita closed 5 years ago
I'm also getting encoding issues using the serve-static
library, which also uses fs.pipe
.
Attached is the original image & the served image.
Are you sure your API gateway is correctly configured to handle binary content encoding and so on?
You're right. The API gateway BinaryMediaTypes
& serverless-http
global
option needs to be configured.
Globals:
Api:
BinaryMediaTypes:
- image~1png
- image~1gif
- image~1jpg
- image~1jpeg
- image~1x-icon
import serverless from 'serverless-http'
const handler__serverless = serverless(app, {
binary(headers) {
return true
},
})
module.exports.handler = handler__serverless
I'm using sirv to serve static images. Serve uses the following to write the file to the response stream.
I'm getting a corrupted image with random pixels. Does serverless-http support
fs.pipe
or is this an issue?