Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in AWS by (19.1k points)

I am trying to call a DynamoDB client method and get one item from the DynamoDB table. I am using AWS Lambda. However, I keep getting the message:

"Process exited before completing request."

I have increased the timeout just to make sure, but the processing time is less than the timeout. Any advice?

console.log('Loading event');

var AWS = require('aws-sdk');

var dynamodb = new AWS.DynamoDB({apiVersion: '2012-08-10'});

exports.handler = function(event, context) {

dynamodb.listTables(function(err, data) {

});

var params = {

    "TableName": "User",

     "Key":

        {"User Id"   : {"S":event.objectId}

    },

    "AttributesToGet"   : ["First Name","Last Name", "Latitude", "Longitude"],

    "ConsistentRead"    : true

  }


 

   dynamodb.getItem(params, function(response,result) {

    response.on('data', function(chunk){

    console.log(""+chunk);

    console.log("test1")

    context.done(result);

});

result.on('ready', function(data){

    console.log("test2")

    console.log("Error:" + data.error);

    console.log("ConsumedCapacityUnits:" + data.ConsumedCapacityUnits);

     context.done('Error',data);

    // ...

});

});

};

1 Answer

0 votes
by (44.3k points)

Basically, this means there is some error in your code. “Process exited before completing the request” message will be prompted when the Javascript function exited before calling the method context.done (or context.succeed, etc.).

To find out the error, you can put console.log messages in every execution point of your code, run it and find the error by looking at the logs.  

Also, increase the memory capacity of your Lambda function and see if that works.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94k users

Browse Categories

...