Lambda does not send message to SQS destination if invoked by an SQS source

I have the following set up:

SQS#1 -> Lambda -> SQS#2

I have a simple return in my Lambda function right now:

async function handler(event) {
  return 'success';
}

If I invoke the lambda from the aws-cli using:

aws lambda invoke --function-name tt-yt-automation-production-1b2b-tiktok-download --invocation-type Event --cli-binary-format raw-in-base64-out /dev/null

It will return the message to the destination SQS (SQS#2), which will trigger another Lambda.

However, if SQS#1 has a message and invokes the Lambda, it does not send a message to SQS#2 and invokes the next Lambda in line.

My suspicion is that an SQS invocation doesn’t count as an asynchronous invocation and won’t send a message to SQS#2.

Is there a configuration I’m missing?

>Solution :

My suspicion is that an SQS invocation doesn’t count as an asynchronous invocation and won’t send a message to SQS#2.

You are correct. SQS invocation is synchronous. You have to "manually" (using AWS SDK) submit messages from your lambda to your SQS#2.

Leave a Reply