New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing timeout as a string is throwing an error in the latest version of axios due to upgrade of follow-redirects #3778
Comments
technically, the timeout option is defined as |
Yes, but if you use axios with the 2 mentioned versions of follow-redirects, you'll see that axios is accepting a string value for As you can see from 2 of my screenshots, axios is not causing the problem, but rather the downstream service is causing the problem. Since I am a consumer of |
I would suggest to do a |
axios doesn't have type validators for the common options, so accepting string as timeout was an incidental behavior. As you can see, even axios v0.16.0 had the timeout option defined as a number type. |
Hi, is it possible for someone to create a pull request and associated regression and unit test for this and tag me to review? |
I'm doing this :). I think I can finish it today |
@jasonsaayman I can't tag you as a reviewer, I guess I don't have access :( |
Describe the bug
Axios uses
follow-redirects
internally for making http requests. When axios was using follow-redirects@1.13.3, we were able to supply timeout in string, e.g. '30000'. Recently,follow-redirects
upgraded to v1.14.0. Upon supplying the timeout as a string, eg. '30000', follow-redirects@1.14.0 is throwing the following error:ERROR Uncaught Exception { "errorType": "TypeError", "errorMessage": "The \"msecs\" argument must be of type number. Received type string ('30000')", "code": "ERR_INVALID_ARG_TYPE", "stack": [ "TypeError [ERR_INVALID_ARG_TYPE]: The \"msecs\" argument must be of type number. Received type string ('30000')", " at validateNumber (internal/validators.js:125:11)", " at getTimerDuration (internal/timers.js:381:3)", " at TLSSocket.setStreamTimeout [as setTimeout] (internal/stream_base_commons.js:250:11)", " at RedirectableRequest.destroyOnTimeout (/opt/nodejs/node_modules/follow-redirects/index.js:159:12)", " at RedirectableRequest.emit (events.js:314:20)", " at RedirectableRequest.EventEmitter.emit (domain.js:483:12)", " at ClientRequest.eventHandlers.<computed> (/opt/nodejs/node_modules/follow-redirects/index.js:14:24)", " at ClientRequest.emit (events.js:326:22)", " at ClientRequest.EventEmitter.emit (domain.js:483:12)", " at tickOnSocket (_http_client.js:709:7)" ] }
To Reproduce
Try the above code with follow-redirects version v1.13.3 and v1.14.0. You will find that the error is thrown when you are using v1.14.0 and the code runs fine when using v1.13.3.
Expected behavior
No error thrown by the code.
Environment
Additional context/Screenshots
The text was updated successfully, but these errors were encountered: