You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just tried to use this library to harvest the contents from an OpenSearch endpoint. However, it seems that the library is only intended for the browser. Using it within NodeJS I currently get this error (using pnpm instead of npm):
Error: Could not parse XML document.
at parseXml (...\node_modules\.pnpm\[email protected]\node_modules\opensearch-browser\dist\utils.js:54:9)
at Function.fromXml (...\node_modules\.pnpm\[email protected]\node_modules\opensearch-browser\dist\description.js:165:40)
at Function.fromXml (...\node_modules\.pnpm\[email protected]\node_modules\opensearch-browser\dist\service.js:289:71)
at ...\node_modules\.pnpm\[email protected]\node_modules\opensearch-browser\dist\service.js:276:34
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Looking inside util.jsparseXML(), I see a hard dependency on DOMParser or ActiveXObject. Both of which are not available within NodeJS.
The configuration also seems to lack an option to pass a custom XML-parser, so for now one can not use the library using NodeJS. Maybe there are other dependencies like that, which I did not yet discover.
For NodeJS compatibility, I see two options:
Include an isomorphic DOMParser like you already did with isomorphic-fetch (I'm not aware of any particular library for DOMParser, though)
Allow to configure the XML-parser to be used. That way one could use, e.g., xmldom to take care of the parsing.
The text was updated successfully, but these errors were encountered:
I just tried to use this library to harvest the contents from an OpenSearch endpoint. However, it seems that the library is only intended for the browser. Using it within NodeJS I currently get this error (using pnpm instead of npm):
Looking inside
util.js
parseXML()
, I see a hard dependency onDOMParser
orActiveXObject
. Both of which are not available within NodeJS.The configuration also seems to lack an option to pass a custom XML-parser, so for now one can not use the library using NodeJS. Maybe there are other dependencies like that, which I did not yet discover.
For NodeJS compatibility, I see two options:
DOMParser
like you already did withisomorphic-fetch
(I'm not aware of any particular library forDOMParser
, though)xmldom
to take care of the parsing.The text was updated successfully, but these errors were encountered: