Thursday, 13 April 2017

Unable to debug and run the Lambda function locally using node js

Am unable to debug the following lambda function using node js in visual studio.I put the debugger in exports.handler.But the debugger is not hitting inside the handler function.

exports.handler = function (event,callback) {

downloadZipFile(params, downloadPath, function (err) {
    if (err) {
        callback(err);
    }
    else {
       // UploadFile(xmlPath, function (err) {
              processZipFile(downloadPath, function (err) {
            if (err) {
                callback(err);
            } else {
                callback(null,"success");
            }
        });

    }
   });
UploadFile();
}

function UploadFile() {
var xmlPath = xmlPaths;
var body = fs.createReadStream(xmlPath)

var srcfileKey = "sample.txt";
// Upload the stream
var s3obj = new AWS.S3({ params: { Bucket: bucketName, Key: srcfileKey } });
s3obj.upload({ Body: body }, function (err, data) {
    if (err) {
        console.log("An error occurred", err);
    }

      });
}

http.createServer(function (req, res) {
 res.writeHead(200, { 'Content-Type': 'text/plain' });
 res.end('Hello World\n');
}).listen(port);



via Sharan

No comments:

Post a Comment