Skip to content
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

Axios default maxBodyLength = 10MB, no way to override #45

Closed
trevyn opened this issue Jun 28, 2018 · 7 comments
Closed

Axios default maxBodyLength = 10MB, no way to override #45

trevyn opened this issue Jun 28, 2018 · 7 comments
Assignees
Labels
bug downstream Things arising from downstream dependencies

Comments

@trevyn
Copy link

trevyn commented Jun 28, 2018

Looks like the switch to Axios has also limited upload parts to 10MB, since there's no way to access the underlying Axios object to set a larger maxBodyLength.

@yakovkhalinsky yakovkhalinsky added bug downstream Things arising from downstream dependencies labels Jun 28, 2018
@jamiesyme
Copy link
Contributor

It looks like the issue was half-fixed with this PR, which is merged in axios@0.18.0. This allows us to specify a maxContentLength option to axios, and as long as it's large enough, everything is a-okay. In my tests, I just passed the file part size as the maxContentLength and that seemed to work.

However, it's only "half-fixed" because you need to explicitly pass maxContentLength to axios, otherwise it will allow the internal follow-redirects package to use the default 10MB. I found this issue which seems to identify the problem, but there hasn't been much activity on it lately.

Perhaps using the file part size as the maxContentLength is a reasonable workaround for now?

@roccomuso
Copy link

I can confirm that with axios@0.18.0 it works.

arboehme added a commit to arboehme/directus-sdk-javascript that referenced this issue Aug 16, 2018
@damianobarbati
Copy link

damianobarbati commented Oct 5, 2018

I currently worked this around with maxContentLength: Infinity, anyway:

  • shouldn't axios fill maxContentLength with actual formData object size? (I'm uploading multipart files)
  • shouldn't axios throw error instead of returning an empty/undefined response?

Since response is undefined an interceptor like the following goes in error while trying to access statusText on undefined!

    instance.interceptors.response.use(response => {
        console.log(response.statusText);
        return response;
    }, error => {
        console.error(error.response && error.response.statusText || error.response);
        return error;
    });

@pkyt
Copy link

pkyt commented Jan 11, 2019

One way to configure maxBodyLength in axios
// Setting Global follow-redirects maxBodyLength
var followRedirects = require('follow-redirects');
followRedirects.maxBodyLength = 100 * 1024 * 1024; // 100 MB

@Amit-A Amit-A self-assigned this Feb 20, 2019
@Amit-A
Copy link
Collaborator

Amit-A commented Feb 20, 2019

#62 should fix this - allows access to the underlying axios object

@Amit-A
Copy link
Collaborator

Amit-A commented Feb 26, 2019

#62 merged, fixed.

@Amit-A Amit-A closed this as completed Feb 26, 2019
@LunarFuror
Copy link

LunarFuror commented Jun 7, 2019

I can confirm here that for those of you using putFileContents having an issue here,

await client.putFileContents( globals.GLOBAL_NEXTCLOUD_FOLDER + fileName, file.buffer, {
            overwrite: false,
            maxContentLength: 1024 ** 3
        });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug downstream Things arising from downstream dependencies
Projects
None yet
Development

No branches or pull requests

8 participants