The Lambda response is
{
"errorMessage": "handler returns a single value, but it does not implement error",
"errorType": "errorString"
}
ref aws document
The example shows that only need to return fail messages without error.
And I have enabled the Report batch item failure option in Lambda trigger.
My golang code in lambda is like
type SQSBatchResponse struct {
BatchItemFailures []SQSMessage
}
type SQSMessage struct {
MessageId string
}
func Handler(_ context.Context, sqsEvent events.SQSEvent) (sqsResponse SQSBatchResponse) {
// code
return sqsResponse
}
It seems that the response structure should be like this.
Aws-lambda-go
type SQSEventResponse struct {
BatchItemFailures []SQSBatchItemFailure `json:"batchItemFailures"`
}
type SQSBatchItemFailure struct {
ItemIdentifier string `json:"itemIdentifier"`
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With