Tech

AWS Lambda Destinations – bugs review


AWS announced a new feature called “AWS Lambda Destinations” for the purpose of asynchronous invocations of Lambda functions. When we invoke the Lambda function asynchronously it passes the message or event to some other AWS service (specific to our own design). In this specific step, we can use SNS topic, SQS queue, Lambda function, or EventBridge event bus as a destination.

In our scenario, while working on an internal project I have tested this feature through a console. The idea was to have a Lambda function that will pass the event to the other two Lambda functions on status “Success execution”. This was my observation in the process:

Bug #1 – it’s not possible to test this feature from within the console

There are three ways to invoke Lambda function:

  1. Synchronous Invokes
  2. Asynchronous Invokes
  3. Poll-Based Invokes

As mentioned earlier, event is passed further to Destination only if Lambda function was invoked asynchronously. However, when we hit the “Test” button, to issue a test of a function we created so we could see how the event is passed to two other test Lambda functions, it seems as if no functions were triggered thus, no even is being passed to predefined Destination.

Important to note is that there are no error messages, logs, nothing that would indicate some sort of a problem. Also, official AWS documentation does not mention this behaviour and scenario. This leads me to the conclusion that the Lambda function we wanted to invoke asynchronously is actually being invoked synchronously.

With this conclusion in mind, the only way to trigger functions asynchronously is bu CLI. The command is as follows:

aws lambda invoke –function-name my-function –invocation-type Event  response.json

AWS official documentation can help you with reviewing the invocation methods. For our specific example steps 1 through 5 on this page under the “Invoke the Lambda function” topic are what is important to send asynchronous call for Lambda function:

  1. Under the Lambda console, in the upper right corner find the “Test” option.
  2. In the Configure test event page, find Create new test event and in Event template, leave the “Hello World” option. Type in the Event name and use the following format for your JSON data:
    {
    “key3”: “value3”,
    “key2”: “value2”,
    “key1”: “value1”
    }
  3. Choose Create and then Test.
  4. AWS Lambda executes the function.
  5. Upon successful execution, view results in the console.

NOTE: This is the summary of steps you can read on the documentation page above.

Bug #2 – It’s not possible to add two Destinations of the same type and same execution status

Important note: The problem was detected when Destinations were added through console.

First to cover the AWS Lambda Destinations types:

  1. SNS topic
  2. SQS queue
  3. Lambda function or EventBridge event

Now to cover the conditions for using the AWS Lambda Destinations:

  1. on Failure
  2. onSuccess

Now, let’s see what I’ve found. In one moment there can be only one Destination with condition onFailure OR onSuccess. We needed to have two Destinations of type Lambda Function and both would be triggered on onSuccess. This setup is not possible to create through the console when you try to do that, the platform leaves only the last Destination added – previously added one is being removed.

For this particular bug we don’t have the workaround which AWS can provide, unlike first found bug in this post.

Both bugs were confirmed on GitHub and status can be monitored on this link: https://github.com/aws/aws-cdk/issues/7652.

We’ll our best to write back or EDIT this post with updates on this matter. Stay tuned and check out our other tech blog posts!

 

Mile Stojaković


Mile Stojaković

Navigating the intersections of cutting-edge technology domains at BlueGrid.io.

Share this post

Share this link via

Or copy link