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

171
Views
why my lambda is not able to download file?

I am trying to download a file and store in /tmp of lambda, in log i can only see first hey, why i am not able to see any catch error or any other logs.

In local it works pretty fine.

const https = require('https');
const fs = require('fs');

// const url =
//   'someurl';

function downloadfile(url) {
  console.log('hi')
  const req = https.get(url, function (res) {
    const fileStream = fs.createWriteStream('testObject.obj');
    res.pipe(fileStream);

    fileStream.on('error', function (err) {
      console.log('error writing to the stream');
      console.log(err);
    });

    fileStream.on('finish', function () {
      fileStream.close();
      console.log('done');
    });
  });

  req.on('error', function (err) {
    console.log('error downloading the file');
    console.log(err);
  });
}





exports.handler = async (event) => {
    downloadfile(
  'someurl'
);
   
};
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You're trying to write to ./, the only directory accessible by lambdas is ./tmp

As per AWS docs

There is also a local file system available at /tmp for all Lambda functions

about 4 years ago · Juan Pablo Isaza Report
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!