Lambda Events 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
- AWSLambdaBasicExecutionRole
- AmazonSQSFullAccess
- AmazonEventBridgeFullAccess
- AWSLambda_FullAccess
- EventBridge
- Amazon_EventBridge_Invoke_Api_Destination
- AmazonEventBridgeFullAccess
- 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,
}
}
If you are using Lambda Destination to trigger EventBridge that will not work. The reason is that Lambda Destinations works only for Asynchronous invocation. In the case of SQS -> Lambda it is an Event source mapping invocation, which under the hood uses Synchronous invocations.
If you need to send an event to EventBridge, just send it from your Lambda code.
Relevant questions
Unable to send event via EventBridge
asked a month agoSES Open and Click Tracking Not Working
Accepted Answerasked 3 years agoIs it possible to use an internal RabbitMQ (ACtiveMQ) endpoint as an EventBridge Rule API Destination?
asked 2 days agoEventBridge + Kinesis
Accepted Answerasked 2 months agoLambda Events not triggering EventBridge destination
Accepted Answerasked 19 days agoEventBridge API Destination Connection AWS Secretes Manager Pricing
asked 4 months agoRun Lambda when a caller disconnects
Accepted Answerasked 19 days agoCloud Watch Event Integration With Third Party Tool
Accepted Answerasked 4 months agoHow to set up EventBridge Api Destination/Connection to Google Cloud?
asked 18 days agoGreengrass v2 - deployment status check with EventBridge
Accepted Answerasked 2 months ago
Thank you, I have now managed to get it working using the lambda script.