'AWS Lambda Destination not triggering EventBridge destination

I am using the Amazon Selling Partner API (SP-API) and am trying to set up a Pub/Sub like system for receiving customer orders etc.

The Notifications API in SP-API sends notifications of different types in 2 different ways depending on what event you are using. Some send directly to eventBridge and others are sent to SQS. https://developer-docs.amazon.com/sp-api/docs/notifications-api-v1-use-case-guide#section-notification-workflows

I have correctly set up the notifications that are directly sent to eventBridge, but am struggling to work the SQS notifications. I want all notifications to be send to my own endpoint.

For the SQS model, I am receiving notifications in SQS, which is set as a trigger for a Lambda function (This part works). The destination for this function is set as another eventBridge (this is that part that doesn't work). This gives the architecture as: SQS => Lambda => eventBridge => my endpoint

Why is lambda not triggering my eventBridge destination in order to send the notifications?

Execution Role Policies:

  • Lambda
    1. AWSLambdaBasicExecutionRole
    2. AmazonSQSFullAccess
    3. AmazonEventBridgeFullAccess
    4. AWSLambda_FullAccess
  • EventBridge
    1. Amazon_EventBridge_Invoke_Api_Destination
    2. AmazonEventBridgeFullAccess
    3. AWSLambda_FullAccess

EventBridge Event Pattern:

{"source": ["aws.lambda"]}

Execution Role Trusted Entities:

  • EventBridge Role "Service": ["events.amazonaws.com", "lambda.amazonaws.com", "sqs.amazonaws.com"]
  • Lambda Role "Service": ["lambda.amazonaws.com", "events.amazonaws.com", "sqs.amazonaws.com"]

Lambda Code:

exports.handler = function(event, context, callback) {
   console.log("Received event: ", event);
   context.callbackWaitForEmptyEventLoop = false
   callback(null, event);
   return {
      statusCode: 200,
   }
}


Solution 1:[1]

Would it be possible to share the access policy for SQS que? I have setup the SQS que to receive notifications but nothing is landing in my SQS que, the subscription and destination is setup, I am suspecting that there is an issue with the access, it would be very helpful is you could share the access policy format that is working for your SQS que.

This is what I am using:

{
  "Version": "2012-10-17",
  "Id": "Policy1652298563852",
  "Statement": [
    {
      "Sid": "Stmt1652298557402",
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::82382xxxx:root"
      },
      "Action": [
        "sqs:SendMessage",
        "sqs:SetQueueAttributes"
      ],
      "Resource": "arn:aws:sqs:us-east-1:823829xxxx:SDNotificationsQueue1"
    }
  ]
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sagar Darekar