Dependency xml2js Impacting Library
envgap__aws__aws-sdk-js-4558
01 / FAILURE SIGNATURE
As reported upstream
TypeError: element.hasOwnProperty is not a function
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
c93f0823f37bd2257f469de8d98af23197986623- Manifest
package.json- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
aws/aws-sdk-js #4558 · read the original issue
### 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.
```js
// 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.)
linux04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]