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
axios.get(url) is never returning the response when the following error occurs. It should have rejected the promise internally so that caller will get an exception. This issue is raised all the way to the process.on("uncaughtException"... I checked the http.js file line 251. I think if node throws an error here the settle will never be called. Do we need try-catch for the stream.end callback?
RangeError: Array buffer allocation failed
at new ArrayBuffer ()
at new Uint8Array ()
at new FastBuffer (internal/buffer.js:956:5)
at createUnsafeBuffer (buffer.js:152:12)
at allocate (buffer.js:419:10)
at Function.allocUnsafe (buffer.js:384:10)
at Function.concat (buffer.js:564:25)
at IncomingMessage.handleStreamEnd (/home/posintg/verifone-21.06.30/node_modules/axios/lib/adapters/http.js:251:37)
at IncomingMessage.emit (events.js:387:35)
at endReadableNT (internal/streams/readable.js:1317:12)
To Reproduce
It is hard to reproduce. You would have to cause exception at line below
stream.on('end',functionhandleStreamEnd(){varresponseData=Buffer.concat(responseBuffer);//error is thrown hereif(config.responseType!=='arraybuffer'){responseData=responseData.toString(config.responseEncoding);if(!config.responseEncoding||config.responseEncoding==='utf8'){responseData=utils.stripBOM(responseData);}}response.data=responseData;settle(resolve,reject,response);});// Example code hereconstresponse=awaitaxios.get(url);
// Example code hereconstresponse=awaitaxios.get(url);
Expected behavior
Should reject the promise and so caller would be able to handle it.
Environment
Axios Version 0.21.1
Adapter HTTP
Browser n/a
Browser Version n/a
Node.js Version 14.17.2
OS: Debian 10
Additional Library Versions: n/a
Additional context/Screenshots
none
The text was updated successfully, but these errors were encountered:
Describe the bug
axios.get(url)
is never returning the response when the following error occurs. It should have rejected the promise internally so that caller will get an exception. This issue is raised all the way to the process.on("uncaughtException"... I checked the http.js file line 251. I think if node throws an error here the settle will never be called. Do we need try-catch for the stream.end callback?RangeError: Array buffer allocation failed
at new ArrayBuffer ()
at new Uint8Array ()
at new FastBuffer (internal/buffer.js:956:5)
at createUnsafeBuffer (buffer.js:152:12)
at allocate (buffer.js:419:10)
at Function.allocUnsafe (buffer.js:384:10)
at Function.concat (buffer.js:564:25)
at IncomingMessage.handleStreamEnd (/home/posintg/verifone-21.06.30/node_modules/axios/lib/adapters/http.js:251:37)
at IncomingMessage.emit (events.js:387:35)
at endReadableNT (internal/streams/readable.js:1317:12)
To Reproduce
It is hard to reproduce. You would have to cause exception at line below
Expected behavior
Should reject the promise and so caller would be able to handle it.
Environment
Additional context/Screenshots
none
The text was updated successfully, but these errors were encountered: