diff --git a/lambda/dynamoUtil.js b/lambda/dynamoUtil.js index aed6933f..d36105da 100644 --- a/lambda/dynamoUtil.js +++ b/lambda/dynamoUtil.js @@ -520,7 +520,8 @@ async function restoreAvailablePass(pk, sk, orcNumber, shortPassDate, facilityNa Key: { pk: { S: pk }, sk: { S: sk } - } + }, + ConditionExpression: 'attribute_exists (pk) AND attribute_exists (sk)' } }, { @@ -529,7 +530,8 @@ async function restoreAvailablePass(pk, sk, orcNumber, shortPassDate, facilityNa Key: { pk: { S: passPk }, sk: { S: passSk } - } + }, + ConditionExpression: 'attribute_exists (pk) AND attribute_exists (sk)' } }] }; diff --git a/lambda/writePass/index.js b/lambda/writePass/index.js index 812ff36a..939763bc 100644 --- a/lambda/writePass/index.js +++ b/lambda/writePass/index.js @@ -488,7 +488,7 @@ async function transactWriteWithRetries(transactionObj, maxRetries = 3) { cancellationReasons = cancellationReasons.slice(0, -1); cancellationReasons = cancellationReasons.split(', '); let message = error.message; - let reasonIndex = this.cancellationReasons.findIndex((i) => i !== 'None'); + let reasonIndex = cancellationReasons.findIndex((i) => i !== 'None'); if (reasonIndex > -1) { switch (reasonIndex) { case 0: