Skip to content

Instantly share code, notes, and snippets.

@SalvoCozzubo
Created February 16, 2022 22:48
Show Gist options
  • Save SalvoCozzubo/e816ae129ba1409c6e3f253afd8b3449 to your computer and use it in GitHub Desktop.
Save SalvoCozzubo/e816ae129ba1409c6e3f253afd8b3449 to your computer and use it in GitHub Desktop.
Partial Batch Failure SQS
module.exports.index = async (event) => {
const failedIds = event.Records.reduce((acc, item, index) => {
// half of records fail
if (index % 2 === 0) {
acc.push({ itemIdentifier: item.messageId });
}
return acc;
}, []);
return {
batchItemFailures: failedIds,
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment