Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

121
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!