Description
When calling IAmazonEventBridge.PutEventsAsync with an event entry having the Resources property initialized to a collection containing a null string, the service returns a generic InternalFailure error containing the message "Internal Service Failure".
The documentation for InternalFailureException indicates it is thrown due to unknown circumstances, however this appears to be a simple input validation gap on the EventBridge backend: if null resource values are not accepted, then they should be validated.
Reproduction Steps
- Call
IAmazonEventBridge.PutEventsAsync with an event containing a null entry in the Resources collection (see example below):
public class Something
{
private readonly IAmazonEventBridge amazonEventBridge;
public Something(IAmazonEventBridge amazonEventBridge)
{
this.amazonEventBridge = amazonEventBridge;
}
public async Task PublishEventAsync()
{
var request = new PutEventsRequest
{
Entries =
{
new PutEventsRequestEntry
{
Detail = "{}",
DetailType = "EventType",
Source = "EventSource",
// Notice this adds a 'null' element to the collection, which is different than setting the collection to 'null'
Resources = { null },
},
},
};
var response = await this.amazonEventBridge.PutEventsAsync(request);
}
}
- Observe the returned payload in
response:
{
"Entries": [{
"ErrorCode": "InternalFailure",
"ErrorMessage": "Internal Service Failure",
"EventId": null
}
],
"FailedEntryCount": 1,
"ResponseMetadata": {
"RequestId": "a99c1d6a-d800-4bda-b1b4-f54f3996ef2c",
"Metadata": {}
},
"ContentLength": 108,
"HttpStatusCode": 200
}
Environment
- SDK Version:
- Package Version:
AWSSDK.EventBridge v3.5.4.26
- OS Info: Windows 10
- Build Environment Visual Studio
- Targeted .NET Platform: NetCore 3.1
Resolution
The problem here appears to be related to input validation on the EventBridge API. Instead of returning an InternalError, which basically means "we have no idea what happened here", it should be validating that none of the entries in Resources is null and returning a more appropriate error and message when that's the case.
The current error might end up causing frustration on developers who for some reason have this value coming from an external place and the resource value there being null.
I stumbled upon this while testing my logic by passing the InvokedFunctionArn value from my lambda to the resources collection. Unfortunatelly, InvokedFunctionArn is always null while testing with the Mock Lambda Tool, which resulted in the resource value being null in the event.
This is a 🐛 bug-report
Description
When calling
IAmazonEventBridge.PutEventsAsyncwith an event entry having theResourcesproperty initialized to a collection containing anullstring, the service returns a genericInternalFailureerror containing the message "Internal Service Failure".The documentation for
InternalFailureExceptionindicates it is thrown due to unknown circumstances, however this appears to be a simple input validation gap on the EventBridge backend: ifnullresource values are not accepted, then they should be validated.Reproduction Steps
IAmazonEventBridge.PutEventsAsyncwith an event containing anullentry in theResourcescollection (see example below):response:{ "Entries": [{ "ErrorCode": "InternalFailure", "ErrorMessage": "Internal Service Failure", "EventId": null } ], "FailedEntryCount": 1, "ResponseMetadata": { "RequestId": "a99c1d6a-d800-4bda-b1b4-f54f3996ef2c", "Metadata": {} }, "ContentLength": 108, "HttpStatusCode": 200 }Environment
AWSSDK.EventBridge v3.5.4.26Resolution
The problem here appears to be related to input validation on the EventBridge API. Instead of returning an
InternalError, which basically means "we have no idea what happened here", it should be validating that none of the entries inResourcesisnulland returning a more appropriate error and message when that's the case.The current error might end up causing frustration on developers who for some reason have this value coming from an external place and the resource value there being
null.I stumbled upon this while testing my logic by passing the
InvokedFunctionArnvalue from my lambda to the resources collection. Unfortunatelly,InvokedFunctionArnis alwaysnullwhile testing with the Mock Lambda Tool, which resulted in the resource value beingnullin the event.This is a 🐛 bug-report