A note on the above answer, if the event is triggered by CLI/API with a custom event pattern then the event.source
will be the one specified in the triggering call.
const client = new EventBridgeClient({});
const event = new PutEventsCommand({
Entries: [
{
Source: "my_custom_source", // in this case `event.source` == "my_custom_source"
Detail: JSON.stringify({ "a": "b"}),
DetailType: "self trigger",
Resources: [context.invokedFunctionArn],
},
],
});