Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

164
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda