node-soap icon indicating copy to clipboard operation
node-soap copied to clipboard

Bumped Axios version to ">=0.25.0"

Open aniltallam opened this issue 1 year ago • 17 comments

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

aniltallam avatar Jul 18 '22 07:07 aniltallam

@vpulim can you look at this PR . btw some test cases are failing. not sure if we can ignore and comment them.

aniltallam avatar Aug 17 '22 19:08 aniltallam

@aniltallam please update with the latest from master

jsdevel avatar Aug 17 '22 22:08 jsdevel

I think this is covered by #1192

benasher44 avatar Oct 07 '22 20:10 benasher44

I have conflicts when using this package with the latest [email protected] installed in my project.

Hope the axios in node-soap could updated!

liudonghua123 avatar Oct 20 '22 08:10 liudonghua123

Hope the axios in node-soap could updated!

I Hope too, the axios updated!

becerriljc avatar Nov 10 '22 01:11 becerriljc

But this pr seems not work, the code related to axios need to update too.

liudonghua123 avatar Nov 10 '22 02:11 liudonghua123

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.

lehh avatar Nov 20 '22 12:11 lehh

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>

liudonghua123 avatar Nov 22 '22 01:11 liudonghua123

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.

liudonghua123 avatar Nov 25 '22 01:11 liudonghua123

plz resolve the conflicts

jsdevel avatar Dec 09 '22 17:12 jsdevel

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).

andrew-dias avatar Dec 15 '22 15:12 andrew-dias

No it was a mistake. Didn't realize axios was 1.0. Should probably just upgrade this package?

benasher44 avatar Dec 15 '22 16:12 benasher44

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).

andrew-dias avatar Dec 15 '22 16:12 andrew-dias

It was just the latest available version at the time

benasher44 avatar Dec 15 '22 17:12 benasher44

I am able to work with axios v1.x by using the overrides field in package.json:

  "overrides": {
    "soap": {
      "axios": ">=0.25.0"
    }
  },

andrew-dias avatar Dec 19 '22 21:12 andrew-dias

Can we mark the peer dependency to support old and new versions?

"peerDependencies": {
  "axios": "^0.27.2 || ^1.2.2"
}

rmkanda avatar Jan 03 '23 14:01 rmkanda

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"
  },

andrew-dias avatar Jan 10 '23 21:01 andrew-dias

Should not be problem anymore, new version released with updated axios.

w666 avatar Apr 18 '24 08:04 w666