Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

168
Vistas
Nodejs upload file to S3

I'm using Serverless Framework with AWS Lambda to upload files/images to S3. The data come from a multipart/form-data form so I get file(s) in binary format.

Example of POST request from REST client (Insomnia)

Upload to S3 code :

this.client
    .putObject({
        Bucket: s3bucket,
        Key: s3path,
        Body: Buffer.from(data, 'binary'),
        ContentType: params.mimetype
    })
    .promise();

The problem is files or images uploaded to S3 are corrupted :

The image "http://xxxxx.eu-west-3.amazonaws.com/xxx cannot be displayed because it contains errors.

I already set binaryMediaTypes in my Serverless file config for api gateway :

apiGateway: {
  binaryMediaTypes: ['*/*'],
},

and the same in AWS API Gateway Binary Media Types config, I set * / * when * / * means all media types

API Gateway Config

Have you ever encountered this problem ?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

  1. In the integration request check if the content handling: passthrough
  2. Accept the incoming request headers in HTTP Headers section. Refer this

Related issue

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda