Skip to content

Commit

Permalink
Fix: [AEA-4168] - 200 and 409 Response returned for the same Item (#377)
Browse files Browse the repository at this point in the history
## Summary

https://nhsd-jira.digital.nhs.uk/browse/AEA-4168

2 Conflicting responses are returned for the same item if a 409 error is
found due to a duplicate Task.ID. The expected 409 response is returned,
however a 200 is returned with for the same Task.ID noting that the data
is not committed.

- ✨ New Feature
  • Loading branch information
natasafrgk committed Jun 12, 2024
1 parent 3586f8e commit 977b0c2
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ const lambdaHandler = async (event: APIGatewayProxyEvent): Promise<APIGatewayPro
logger.info("No entries to process.")
return response(200, responseEntries)
}

const entriesValid = validateEntries(requestEntries, responseEntries)
if (!entriesValid) {
return response(400, responseEntries)
Expand Down Expand Up @@ -155,6 +154,8 @@ export function handleTransactionCancelledException(
e: TransactionCanceledException,
responseEntries: Array<BundleEntry>
): void {
responseEntries.length = 0

e.CancellationReasons?.forEach((reason) => {
if (reason.Item?.TaskID?.S) {
const taskId = reason.Item.TaskID.S
Expand Down

0 comments on commit 977b0c2

Please sign in to comment.