node-soap
node-soap copied to clipboard
Bumped Axios version to ">=0.25.0"
If the response size for any SOAP API is greater than 0x1fffffe8 characters then getting the following uncaught error and node process is crashing.
Error: Cannot create a string longer than 0x1fffffe8 characters
at Buffer.utf8Slice (<anonymous>)
at Buffer.toString (buffer.js:799:17)
at IncomingMessage.handleStreamEnd (/ws/node_modules/soap/node_modules/axios/lib/adapters/http.js:262:41)
at IncomingMessage.emit (events.js:327:22)
at IncomingMessage.EventEmitter.emit (domain.js:467:12)
at endReadableNT (internal/streams/readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
code: 'ERR_STRING_TOO_LONG'
}
The issue is due to older version of Axios (https://github.com/axios/axios/blob/v0.21.1/lib/adapters/http.js#L253) not properly handling this error.
But this is fixed in v0.25.0 of Axios (https://github.com/axios/axios/blob/v0.25.0/lib/adapters/http.js#L302). So bumped the axios version to >=0.25.0 in the package.json
@vpulim can you look at this PR . btw some test cases are failing. not sure if we can ignore and comment them.
@aniltallam please update with the latest from master
I think this is covered by #1192
I have conflicts when using this package with the latest [email protected]
installed in my project.
Hope the axios in node-soap
could updated!
Hope the axios in
node-soap
could updated!
I Hope too, the axios updated!
But this pr seems not work, the code related to axios need to update too.
I have conflicts when using this package with the latest
[email protected]
installed in my project.Hope the axios in
node-soap
could updated!
I believe it's an axios problem. They fixed it in the axios package itself, and it is supposed to be released on v1.2.0.
I can confirm axios v1.2.0
could fix it. Because v1.2.0
is not release now, I tested with [email protected]
, and it worked.
D:\code\node\soap-example>node mail_ws_test.js
requestToken result: ......
D:\code\node\soap-example>npm i -S axios
added 3 packages, changed 7 packages, and audited 140 packages in 6s
11 packages are looking for funding
run `npm fund` for details
5 vulnerabilities (1 moderate, 1 high, 3 critical)
To address all issues, run:
npm audit fix
Run `npm audit` for details.
D:\code\node\soap-example>node mail_ws_test.js
TypeError: Cannot read properties of undefined (reading 'create')
at new HttpClient (D:\code\node\soap-example\node_modules\soap\lib\http.js:40:59)
at Object.open_wsdl (D:\code\node\soap-example\node_modules\soap\lib\wsdl\index.js:1270:48)
at openWsdl (D:\code\node\soap-example\node_modules\soap\lib\soap.js:70:16)
at D:\code\node\soap-example\node_modules\soap\lib\soap.js:48:13
at _requestWSDL (D:\code\node\soap-example\node_modules\soap\lib\soap.js:76:9)
at createClient (D:\code\node\soap-example\node_modules\soap\lib\soap.js:94:5)
at D:\code\node\soap-example\node_modules\soap\lib\soap.js:104:9
at new Promise (<anonymous>)
at Object.createClientAsync (D:\code\node\soap-example\node_modules\soap\lib\soap.js:103:12)
at main (D:\code\node\soap-example\mail_ws_test.js:64:31)
D:\code\node\soap-example>npm i -S [email protected]
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/axios
npm WARN peer axios@">=0.21.1" from [email protected]
npm WARN node_modules/soap
npm WARN soap@"^0.45.0" from the root project
npm WARN 1 more (the root project)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer axios@">=0.21.1" from [email protected]
npm WARN node_modules/soap
npm WARN soap@"^0.45.0" from the root project
changed 1 package, and audited 140 packages in 2s
11 packages are looking for funding
run `npm fund` for details
5 vulnerabilities (1 moderate, 1 high, 3 critical)
To address all issues, run:
npm audit fix
Run `npm audit` for details.
D:\code\node\soap-example>node mail_ws_test.js
requestToken result: ......
D:\code\node\soap-example>
The 1.2.0 version of axios
is released, see https://www.npmjs.com/package/axios. I tested, it works without change node-soap
code, just update axios
dependence to ^1.2.0
.
plz resolve the conflicts
I think this is covered by #1192
Was it necessary to change the axios
version resolution in #1192 from >=
to ^
? This causes a regression where axios versions >=1.0 are no longer compatible (at least in npm v7+ I think).
No it was a mistake. Didn't realize axios was 1.0. Should probably just upgrade this package?
I wouldn't upgrade the peer dependency to 1.0.0
because that would just break it for anyone still on 0.x
, and we want the peer dependency to reflect the lowest compatible version. We could even drop it back to >=0.25.0
as this PR proposed, if that is the minimum compatible version (I'm not sure if you upgraded to 0.27.2
just because it was the latest available version, or if it was actually required for your PR).
It was just the latest available version at the time
I am able to work with axios v1.x by using the overrides
field in package.json
:
"overrides": {
"soap": {
"axios": ">=0.25.0"
}
},
Can we mark the peer dependency to support old and new versions?
"peerDependencies": {
"axios": "^0.27.2 || ^1.2.2"
}
Can we mark the peer dependency to support old and new versions?
"peerDependencies": { "axios": "^0.27.2 || ^1.2.2" }
No need to be any more restrictive than what this PR already proposes:
"peerDependencies": {
"axios": ">=0.25.0"
},
Should not be problem anymore, new version released with updated axios.