Skip to content

Commit

Permalink
Handle case when sqlStatementResults doesn't have records field, for …
Browse files Browse the repository at this point in the history
…example it contains result of update or insert statement. In this case AWS adds empty object to array
  • Loading branch information
Dzmitry Yeliseyeu committed Aug 28, 2024
1 parent 29b8962 commit 0a3a845
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rds/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ export function toJsonObject(inputStr) {
let perStatement = [];
for (const { records, columnMetadata } of input.sqlStatementResults) {
const statement = [];

if(typeof records === 'undefined' ){
perStatement.push({});
continue;
}
for (const record of records) {
const row = {};
if (record.length !== columnMetadata.length) {
Expand Down

0 comments on commit 0a3a845

Please sign in to comment.