aws / aws-sdk-js

AWS SDK for JavaScript in the browser and Node.js
https://aws.amazon.com/developer/language/javascript/
Apache License 2.0
7.6k stars 1.55k forks source link

Dependency xml2js Impacting Library #4558

Closed WillianAgostini closed 9 months ago

WillianAgostini commented 10 months ago

Describe the bug

This issue is not related to this specific library but rather to a bug present in an older version of one of the dependencies used by this library. This glitch may lead to errors in the library's functionality.

The xml2js library is using version 0.5.0; however, the following bug was identified during this update.

// using xml2js@0.5.0
const xml2js = require("xml2js");
const data = `
<?xml version="1.0" encoding="ISO-8859-1"?>  
<note>
    <address>
        <city>San Francisco</city>
        <state>CA</state>
    </address>
    <address>
        <city>San Diego</city>
        <state>CA</state>
    </address>
</note>`;
const parser = new xml2js.Parser();
parser.parseString(data, function (err, result) {
    result.note.address.forEach(element => {
        element.hasOwnProperty('city');
        console.log(element);
    });
});

This issue has been resolved in versions higher than 0.6.0. Therefore, I recommend updating the package to this version to address potential errors.

Expected Behavior

use version to xml2js@latest

Current Behavior

TypeError: element.hasOwnProperty is not a function

Reproduction Steps

just reproduce code bellow

Possible Solution

No response

Additional Information/Context

No response

SDK version used

2.1525.0

Environment details (OS name and version, etc.)

linux

RanVaknin commented 9 months ago

Thanks for contribution. The PR is merged.