question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Redirect body larger than maxBodyLength not correctly caught

See original GitHub issue

Summary

Recently #1323 has been fixed, however follow-redirects is still not correctly implemented: current version does not handle errors correctly. Indeed, if maxBodyLength is 10MB and the resource fetched after the redirect is bigger, follow-redirects will emit an error but that error will occur outside of axios promise chain.

Error: Request body larger than maxBodyLength limit
      at RedirectableRequest.write (./node_modules/follow-redirects/index.js:66:24)
      at FormData.CombinedStream.write (./node_modules/combined-stream/lib/combined_stream.js:118:8)
      at FormData.CombinedStream._pipeNext (./node_modules/combined-stream/lib/combined_stream.js:106:8)
      at FormData.CombinedStream._getNext (./node_modules/combined-stream/lib/combined_stream.js:79:10)
      at FormData.CombinedStream._pipeNext (./node_modules/combined-stream/lib/combined_stream.js:107:8)
      at FormData.CombinedStream._getNext (./node_modules/combined-stream/lib/combined_stream.js:79:10)
      at FormData.CombinedStream.resume (./node_modules/combined-stream/lib/combined_stream.js:134:10)
      at FormData.CombinedStream.pipe (./node_modules/combined-stream/lib/combined_stream.js:64:8)
      at dispatchHttpRequest (./node_modules/axios/lib/adapters/http.js:227:12)
      at httpAdapter (./node_modules/axios/lib/adapters/http.js:18:10)
      at dispatchRequest (./node_modules/axios/lib/core/dispatchRequest.js:59:10)

Axios should intercept that error and reject the promise

Context

  • axios version: v0.17.1 + master
  • Environment: node v8.4.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:16
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

22reactions
roccomusocommented, Jul 6, 2018

axios should default follow-redirect maxBodyLength limit to Infinity

15reactions
shubhi15commented, May 3, 2018

Facing same issue . Even after adding maxContentLength: 52428890 to axios post request has not fixed it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Request body larger than maxBodyLength limit when ...
You are setting 'maxContentLength': Infinity, 'maxBodyLength': Infinity. In your data object. It should be inside the config object, ...
Read more >
Deploy Ghost Theme Github Actions CI / Error: Request body ...
Error: Request body larger than maxBodyLength limit at RedirectableRequest.module.exports.549.RedirectableRequest.write ...
Read more >
node_modules/axios/CHANGELOG.md - PLMlab
Fixing response with utf-8 BOM can not parse to json (#2419) ... Add test for redirecting with too large response (#2695); Fixing unit...
Read more >
axios error err_bad_response - You.com | The AI Search ...
It is not an issue with the API. To Reproduce. Axios post request throws a network error message. If I make the call...
Read more >
axios/CHANGELOG.md - UNPKG
83, - Fixing changelog to show correct pull request ... 466, Rewrote the comment from "Reject only if the status code is greater...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found