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

113
Visualizações
Reading from AWS S3 is not returning response

I am new to AWS S3 and I am trying to read a csv from an S3 folder. For which I have the below logic.

var prefixList = [];

async function readConfig() {
  const AWS = require("aws-sdk");
  const s3 = new AWS.S3();
  const csv = require("csv-parser");
  const bucket = "my-bucket";
  const objectkey = "/my/folder/path/filename.csv";
  const params = { Bucket: bucket, Key: objectkey };

  const configFile = s3.getObject(params).createReadStream();

  configFile.pipe(csv()).on("data", (data) => {
    prefixList.push(data["PREFIX"]);
  });

  logger.info("PrefixList: " + prefixList);
}

I am trying to print the list and it prints an empty list. The list is not getting appended by the elements from the csv file.

I have confirmed that the file is there in the bucket/folder path I have mentioned. And also, the header PREFIX is present in the csv file. But still something is preventing the push to the list.

Am I missing something here? Please help

EDIT:

Contents in the S3 file:

--------
PREFIX
--------
MR
MRS
MISS
MS
DR
REV
PROF
SIR
--------
about 4 years ago · Santiago Trujillo
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