AWS Lambda: Input values needs to be concatenated with error message

50
June 09, 2021, at 8:40 PM

The query returns the expected result, the request in this forum is regarding the customized error message. Incase of failure the exception needs to stored along with the input values.

This is my first lambda code, please let me know any additional details.

Input

{"EventID":"1246", "DataflowID": "011010"}

Lambda Code (Nodejs), this was nodejs but suggestion in python are also appreciated.

var AWS = require('aws-sdk');
var mydocumentClient = new AWS.DynamoDB.DocumentClient();
exports.handler = function (event, context, callback) {
    var params = {
        TableName: 'TransactionLog',
        KeyConditionExpression : 'EventID = :EventID and Status = :Status',
        FilterExpression : 'EventID in (:EventID) and Status in (:Status)',
        ExpressionAttributeValues: {":EventID": event.WorkflowDetail.EventID,":Status": "progress"},
        ProjectionExpression: "EventID,DataflowID,Status"
      };
    
      
      mydocumentClient.scan(params, function (err, data){
        if (err) {
            callback(err, null);
        }else{
          callback(null, data);
        }
    }
    )
}

Actual Example Error Message: Resource not found.

Expected Error Message: Resource not found "EventID":"1246", "DataflowID": "011010"

I tried using different options but no luck. please advise.

console.log(element.Title.S + " (" + element.Subtitle.S + ")");
Answer 1

Declare all the required events inside the parmas. I'm not sure this is the best solution but it meets my requirement. Thanks!

 var params = {
       ...,
       ....,
        Input: "{\"column1\" : \"" + 'type' + "\",  \"column2\" : \"" + 'time' +\"}"
      };
console.log(params.Input, err);

useful thread: Can execute a step function from a lambda but when I try to pass a value it fails saying input {}

READ ALSO
Aggregated query returning 1s where 0's are expected

Aggregated query returning 1s where 0's are expected

In my devices table, is_muted is 0 for all 4 rows:

52
Parse an HTML string with JS

Parse an HTML string with JS

I searched for a solution but nothing was relevant, so here is my problem:

36
Splitting the text and writing to combo box

Splitting the text and writing to combo box

It's only writes to comboBox1What's the problem? Why doesn't it write to other combo boxes?

31
Complex RegEx pattern Extractor Logic [closed]

Complex RegEx pattern Extractor Logic [closed]

Want to improve this question? Update the question so it focuses on one problem only by editing this post

63