2

I am facing this timeout error in aws editor(nodejs environment). I understand that there maybe be timeout set for 3 seconds, still this small code should run easily within 3 secs. Also, I have used other methods to put data in my dynamoDB like batchWrite and it works fine!

Response:
{
  "errorMessage": "2021-02-08T15:58:57.631Z 66890dfe-6f3a-42ae-b689-510bb8027a9d Task timed out after 3.03 seconds"
}

My code:

const AWS = require('aws-sdk');
const docClient = new AWS.DynamoDB.DocumentClient(
    {
        region:'ap-south-1'
    });

exports.handle = function(event , context ,callback)  {
     var params = {
            TableName: 'guestbook',
         Item:{
             "date":Date.now(),
             "message":"I love your website"
         }
       };
    
  docClient.put(params, function(err,data){
      
      if(err){
      callback(err,null);
      }
      else{
      callback(null,data);
      }
  });
    
};

I am trying to put data into my dynamoDB,. My role policy is

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "dynamodb:*",
            "Resource": "*"
        }
    ]
}

DIPIKESH KUMAR
  • 129
  • 1
  • 6

0 Answers0