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');
// URL of the image
const url ='https://someurl';
exports.handler = async (event) => {
console.log('hey')
try {
https.get(url, (res) => {
console.log('hihi')
const path = '/tmp/' + 'testObject.obj';
const writeStream = fs.createWriteStream(path);
console.log('hi')
res.pipe(writeStream);
console.log('hi2')
writeStream.on('finish', () => {
writeStream.close();
console.log('Download Completed!');
console.log('ji')
});
console.log('hi5')
});
}catch(error){
console.log(error)
}
};